Lager formatter that adds support for custom format specifiers to the metadata.
Lager formatter that adds support for custom format specifiers to the metadata.
It is especially useful when you want to format numbers in different format.
Add to rebar.config
:
{deps, [lager_iowrite_formatter]}.
And then in sys.config
you can use:
{lager, [
{handlers, [
{lager_file_backend, [{file, "error.log"}, {level, error}, {formatter, lager_iowrite_formatter},
{formatter_config, [date, " ", time, {"~.16B", trace_id, "undefined"}," [",severity,"] ",pid, " ", message, "\n"]}]}
]}
]}.
That will print trace_id
metadata attribute using hexadecimal format if value
is present.