logrex v0.6.3 Logrex View Source
An Elixir package for more easily adding Logger metadata and formatting the console output so it's easier for humans to parse.
It wraps Elixir's Logger module to let you write code like this:
> use Logrex
> name = "Matt"
> user_info = %{login_count: 1}
> Logrex.info "New login", [name, user_info.login_count]
To display this:
> INFO 20:56:40 New login user=Matt login_count=1
Link to this section Summary
Functions
Log a debug message with dynamic metadata.
Log an error message with dynamic metadata.
Custom Logger format function, which receives the Logger arguments and returns a string with formatted key/value metadata pairs broken out to the right of the message.
Log an info message with dynamic metadata.
Logs a metadata-only message.
Log a warning message with dynamic metadata.
Link to this section Functions
Log a debug message with dynamic metadata.
Log an error message with dynamic metadata.
Custom Logger format function, which receives the Logger arguments and returns a string with formatted key/value metadata pairs broken out to the right of the message.
Log an info message with dynamic metadata.
Logs a metadata-only message.
It is a shorthand and more explicit way of using one of the level
functions with an empty string as the first parameter. By default, all
meta/1
calls are logged as debug, but that can be changed via the
:meta_level
config.
Examples
Logrex.meta foo: bar
Logrex.meta [var1, var2]
Log a warning message with dynamic metadata.