A drop-in logger formatter for Erlang that outputs messages as line delimited JSON.
This formatter is heavily inspired by flatlog, but it is meant to produce JSON logs.
It does not impose a specific "Erlang term to JSON" formatter and can be configured to use the one you prefer.
Just like flatlog, this formatter should not be added as a dependency in individual libraries.
For configuration instructions, generate and read the Edoc documentation.
Due to Erlang's logger design, log messages are fully generated by the processes that call logging commands, before they are sent to a backend e.g. for writing them on a file.
As a result, if ejsonlog
is used together with Loki and
promtail, the time
field should not be used to
overwrite the default timestamp generated by promtail, as log lines
may end up out-of-order in files.
$ rebar3 compile
This project was created as part of Erlang Solutions' Hackathon on 2021-03-23.