-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Give prevalence to process level over primary/module levels #13955
Conversation
Reproducing the issue:
|
It seems the |
090cd95
to
739eaaa
Compare
739eaaa
to
5e490b6
Compare
Logger.put_process_level/2
precedence in docs
Pushed the change to prefer process level over global level. Will write a test. |
level | ||
end | ||
|
||
process_level -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still need to check if this level is allowed by either calling :logger_config.allow(level)
or by calling :logger_config.allow(level, module)
if we want still want to look up the module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling :logger_config.allow(level, module)
there would give precedence for module/primary level. Pushed some fixes and I believe we have the expected behaviour now :)
@@ -760,7 +784,7 @@ defmodule LoggerTest do | |||
|
|||
test "maps Erlang levels" do | |||
:logger.set_primary_config(:level, :notice) | |||
assert capture_log(fn -> Logger.info("hello") end) =~ "hello" | |||
assert capture_log(fn -> Logger.warning("hello") end) =~ "hello" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what's the behaviour that was being tested here. This started failing when I made capture_log
not change log level
There's a big problem with this approach: elixir and erlang logs behave under different rules. I think this is not desirable and probably we can't merge. |
Closing per the above. Will fix documentation in a separate PR. |
The docs incorrectly implied that
Logger.put_process_level/2
allowed one to decrease the logger level for a process. This is not possible with this function.