-
Notifications
You must be signed in to change notification settings - Fork 3k
Update macro_log typespec #10010
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
base: master
Are you sure you want to change the base?
Update macro_log typespec #10010
Conversation
`log_allowed` which is called by `macro_log` actually accepts `location()` or `#{}`. I noticed this issue when running dialyzer on elixir codebase. There are justified usages of `macro_log` with an empty map argument and dialyzer emits: ``` lib/logger.ex:1005:41: The call 'Elixir.Logger':'__do_log__' (_level@2 :: 'alert' | 'critical' | 'debug' | 'emergency' | 'error' | 'info' | 'notice' | 'warning', _message_or_fun@1 :: any(), #{}, map()) will never return since it differs in the 3rd argument from the success typing arguments: ('alert' | 'critical' | 'debug' | 'emergency' | 'error' | 'info' | 'notice' | 'warning', any(), #{'file' := string(), 'line' := non_neg_integer(), 'mfa' := {atom(), atom(), non_neg_integer()}}, map()) ```
CT Test Results 2 files 70 suites 1h 6m 22s ⏱️ For more details on these failures, see this check. Results for commit 8063623. ♻️ This comment has been updated with latest results. To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass. See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally. Artifacts
// Erlang/OTP Github Action Bot |
Since the calls land in |
I'm not the autor of the elixir code so I don't know the reason
I see that |
Sorry, I misread the code. |
@josevalim Do you know the reason elixir is using hidden |
Looking at the code I can see we have some logic between checking if something is allowed and then doing the logging but perhaps it is no longer necessary, since we have closed many of the gaps between Elixir and Erlang logging. I will take a another look. |
We need to call otp/lib/kernel/include/logger.hrl Line 68 in ec6323d
We need to check for |
log_allowed
which is called bymacro_log
actually acceptslocation()
or#{}
. I noticed this issue when running dialyzer on elixir codebase. There are justified usages ofmacro_log
with an empty map argument and dialyzer emits: