syslog icon indicating copy to clipboard operation
syslog copied to clipboard

Emit log events as :warning instead of :warn

Open jvf opened this issue 1 year ago • 0 comments

In Elixir v1.15 a deprecation warning is emitted if the deprecated log level shortcut warn is:

warning: the log level :warn is deprecated, use :warning instead
  (logger 1.15.7) lib/logger.ex:1137: Logger.elixir_level_to_erlang_level/1
  (logger 1.15.7) lib/logger.ex:591: Logger.compare_levels/2
  (syslog 1.0.0) lib/syslog.ex:37: Logger.Backends.Syslog.handle_event/2
  (stdlib 5.2) gen_event.erl:814: :gen_event.server_update/4
  (stdlib 5.2) gen_event.erl:796: :gen_event.server_notify/4
  (stdlib 5.2) gen_event.erl:538: :gen_event.handle_msg/6

At the same time the Logger passes the log level as warn to the old-style logger backends. Presumably for backwards compatibility. It thus falls to the logger backend to use the correct level identifier when emitting events.

The syslog backend is such a logger backend. This PR adds a code snippet to transform the received level warn to warning.

cc: @harunzengin @weisslj

jvf avatar Feb 06 '24 16:02 jvf