Configurable logger for gleam.
Go to file
wqtt 1f22b0f610
Some checks failed
test / test (push) Failing after 36s
chore(ci): use fqdn for github action
2024-07-30 01:01:47 -04:00
.github/workflows chore(ci): use fqdn for github action 2024-07-30 01:01:47 -04:00
src chore!(project): use internal directory 2024-07-30 00:56:34 -04:00
test chore!(project): use internal directory 2024-07-30 00:56:34 -04:00
.gitignore chore(project): initial commit 2024-07-30 00:40:16 -04:00
gleam.toml chore!(project): use internal directory 2024-07-30 00:56:34 -04:00
LICENSE Initial commit 2024-07-30 03:56:45 +00:00
manifest.toml chore(project): initial commit 2024-07-30 00:40:16 -04:00
pine.svg chore(project): initial commit 2024-07-30 00:40:16 -04:00
README.md chore(docs): fix code example 2024-07-30 00:50:09 -04:00

pine

Package Version Hex Docs

gleam add pine
import pine

pub fn main() {
  // The defaults work out of the box.
  // This will print a line to the console.
  pine.new()
    |> pine.info("hello world!")
  // info <unix millis> hello world!



  // Pine is configurable!
  pine.new()

    // You can set the level.
  |> pine.set_level(pine.level_info())

    // As well as the format.
  |> pine.set_format(pine.format_json())

    // And finally, the transport!
  |> pine.set_transport(pine.transport_file("logs.txt"))



  // Different log functions are on the pine module.
  pine.new()

    // You have access to "debug" logs
    |> pine.debug("debug message")

    // As well as 'info' logs
    |> pine.info("info message")

    // As well as 'warn' logs
    |> pine.warn("warn message")

    // As well as 'err' logs
    |> pine.err("err message")


  // You can add attributes to loggers as needed.
  // This is especially useful for telemetry and tracing.
  pine.new()

    // Such as strings
  |> pine.with_string("version", "v1.0.2")

    // Or ints
  |> pine.with_int("page_views", 69)

    // Or floats
  |> pine.with_float("opacity", 0.89)

    // or bools
  |> pine.with_bool("checked_balance", False)

    // then see them all in action
  |> pine.info("hello world!")
  // info <unix millis> hello world! version=v1.0.2 page_views=69 opacity=0.89 checked_balance=False
}

Further documentation can be found at https://hexdocs.pm/pine.

Development

gleam run   # Run the project
gleam test  # Run the tests