pine
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