Logger backends elixir 1.15.2

Hello People

I am running into a noisy warning in my logs

warning: the log level :warn is deprecated, use :warning instead
 (logger 1.15.2) lib/logger.ex:1137: Logger.elixir_level_to_erlang_level/1
 (logger 1.15.2) lib/logger.ex:591: Logger.compare_levels/2
 (logger_file_backend 0.0.13) lib/logger_file_backend.ex:36: LoggerFileBackend.handle_event/2
 (stdlib 5.0.2) gen_event.erl:802: :gen_event.server_update/4
 (stdlib 5.0.2) gen_event.erl:784: :gen_event.server_notify/4
 (stdlib 5.0.2) gen_event.erl:786: :gen_event.server_notify/4
 (stdlib 5.0.2) gen_event.erl:526: :gen_event.handle_msg/6
 (stdlib 5.0.2) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

This even though I am using Logger.warning instead of Logger.warn, doing some research I found that the library LoggerBackends has a function erlang_level_to_elixir_level[logger_backends/lib/logger_backends/handler.ex at v1.0.0 · elixir-lang/logger_backends · GitHub] which is converting “:warning” into “:warn”

I have two Logger backends one is custom and I have a function to bring back “:warn” to “:warning” but I am also using LoggerFileBackend which does not have this workaround.

Do you know if there is any alternative to avoid this warning in logger_backends library or another option?

Context
Erlang/OTP 26 [erts-14.0.2]
Elixir (1.15.2)
LoggerBackends (1.0.0)

You can use Erlang’s :logger_std_h, but right now I do not remember the correct configuration syntax. You do not need to use additional library as file logging is built-in.

1 Like