I am doing some custom log formatting and I noticed that Logger.critical
messages are treated as errors. I see now from docs Logger — Logger v1.12.3
“This is reported as “error” in Elixir’s logger backends for backwards compatibility reasons.”
So for text logs, I always see [error]
in the “critical” messages so I cannot test that a critical message was logged.
For production we are formatting logs as JSON and pushing to Cloudwatch and we convert the level to a number something like syslogs, like this:
:critical -> 2
:error -> 3
:warn -> 4
I noticed that in the format/5
function Logger.Formatter — Logger v1.12.3 the level is returned as :error
for critical messages.
Is there a way to assert on the log level and see the :critical
level?
Thanks for informations!