Hi All
I’d like to get structured logging in my Erlang app.
I found this very nice article about the concept for Elixit:
Structured (JSON) logs in Elixir
Are there examples I can learn from?
Many thanks
/Zab
Hi All
I’d like to get structured logging in my Erlang app.
I found this very nice article about the concept for Elixit:
Structured (JSON) logs in Elixir
Are there examples I can learn from?
Many thanks
/Zab
There’s this one for Erlang:
logger_formatter_json did the job:
[
{kernel, [
{logger, [
{handler, default, logger_std_h,
#{formatter => {logger_formatter_json, #{}}}
}
]},
{logger_level, info}
]}
].
The only downside is that it depends on thoas.
We also have this logger, which we are using in production:
And its git repo:
I have an OpenAPI schema: Flussonic Media Server API
this schema declared an API endpoint that gives some list of events, but all these events can be emitted in the JSON push webhooks and they are logged in the logger. It is one event subsystem inside whole server.
Each event has its structure and I’ve made a code generator that translates this openapi to erlang typespec for dialyzer to be happy.
One command line option change the output mode of logger from “admin style” to “devops style” and flussonic will output json newline delimited logs with the structure declared in former api.
It is really convenient.
Wow, it looks great.