glimpse_log
A minimal cross-target gleam logging library that helps you get a glimpse into the program. Contains bindings to JavaScript and a gleam implementation for everywhere else.
Note that this is (at least currently) just a nicer API, if you want to customize output (erlang only) you will want to set up a library such as lpil/logging.
gleam add glimpse_log@1
import glimpse
pub fn main() {
// You can call this on any value that can be converted to a StringBuilder via string.inspect()
glimpse.error("An error log")
glimpse.warn("A warning log")
glimpse.info("An info log")
glimpse.debug("A debug log")
// The functions return the term passed into them, so they can be used in pipes!
"A value"
|> glimpse.error
|> glimpse.warn
|> glimpse.info
|> glimpse.debug
4
|> glimpse.info
}
Further documentation can be found at https://hexdocs.pm/glimpse_log.
Development
TODO
- Tests
- Docs
- Format Errors (Erlang:
info(Format,Args[,Metadata])
) ref - Metadata for erlang logger
- format args for JS
gleam run # Run the project
gleam test # Run the tests