Configurable logger for gleam.
Go to file
2024-07-30 00:40:51 -04:00
.github/workflows chore(project): initial commit 2024-07-30 00:40:16 -04:00
src chore(project): initial commit 2024-07-30 00:40:16 -04:00
test chore(project): initial commit 2024-07-30 00:40:16 -04:00
.gitignore chore(project): initial commit 2024-07-30 00:40:16 -04:00
gleam.toml chore(project): bump version 2024-07-30 00:40:51 -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(project): initial commit 2024-07-30 00:40:16 -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