As some of you are aware (and the rest will be if they read this post) the OTP 21 introduced new logger
module which provides real-life logger to the Erlang itself. For a long time (I think that Elixir 1.7 was the first one with integration) Elixir was hooking into it to listen for messages sent by Erlang libraries, but it was only one way integration (so messages sent by Elixir wasn’t available to Erlang handlers).
But it is no more, as PR 9333 was merged to the master, now Logger
is a thin wrapper over Erlang’s built in functionality with compatibility layer on top to support all backends that already are there.
However that one is a huge change and I with @josevalim were working on it for over a month to find all problems and provide good implementation. We are pretty confident with the implementation, but nothing is better than testing in production. So this is time for all of You, embrace your fears and boldly go where no one has gone before. We need You to test it with your applications (of course locally, we do not encourage anyone to test it in real production).
Please, test it, break it, report it.
For those who are interested in “what it will give us anyway?”:
- Unified metadata between loggers (and potentially other libraries like
opentelemetry
) - Out of the box integration with Lager as Lager hooks into
logger
as well - Built in support for logging to disk via
logger_disk_log_h
These are for now, in future the changes will include:
- Additional log levels (
notice
,critical
,alert
,emergency
) - Support for structured logging
- Module and application level control about logs verbosity
But anyway, play with it, test it, and if you break it, let us know so we can polish it before final release of 1.10 (oh, by the way this will make Elixir 1.10 OTP 21+ only).