Fix Elixir 1.19 Logger deprecation warnings - #28
Merged
Merged
Conversation
slashmili
requested changes
May 22, 2026
slashmili
left a comment
Owner
There was a problem hiding this comment.
thanks @digitalninjae !
overall lgtm. could you please remove the comments for the private function.
The legacy :gen_event backend layer delivers warning events using the old :warn level name. Passing that atom to Logger.compare_levels/2 emitted "the log level :warn is deprecated, use :warning instead" on every warning-level log. Normalize :warn to :warning before comparing (in both handle_event/2 and the configured min_level) and match level_to_priority/1 on :warning. Also clears two related deprecations surfaced on Elixir 1.19: - Remove the deprecated $levelpad token from the default format pattern, moduledoc, README, and example/dev configs. - Replace the single-quoted '#Ref' charlist with the ~c"#Ref" sigil in the JSON formatter. Add a warning-level log to the test suite, which previously only exercised debug/info/error and so never triggered the :warn path.
digitalninjae
force-pushed
the
fix-deprecation-warnings
branch
from
May 22, 2026 22:19
6956eef to
aa9e3d0
Compare
Owner
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Resolves the deprecation warnings emitted under Elixir 1.19 / recent
Logger versions. No behavior change beyond the warnings going away.
Why
The legacy
:gen_eventbackend layer delivers warning events using theold
:warnlevel name. Passing that atom toLogger.compare_levels/2prints
the log level :warn is deprecated, use :warning insteadonevery warning-level log, flooding application logs.
Changes
:warnlevel to:warningbefore it reachesLogger.compare_levels/2(in bothhandle_event/2and the configuredmin_level); matchlevel_to_priority/1on:warning.$levelpadtoken from the default formatpattern, moduledoc, README, and example/dev configs.
'#Ref'charlist with the~c"#Ref"sigilin the JSON formatter.
exercised debug/info/error and so never hit the
:warnpath.Out of scope
The
:backendsconfig key is also deprecated, but that originates fromconsumer config and reflects the larger
:gen_event→:loggerhandlermigration. Happy to discuss that separately if you'd like.
Verified
mix testpasses (now including a warning-level log); the threedeprecation warnings no longer appear during compile or test runs.