Skip to content

Commit

Permalink
logger.hrl: use fully qualifier call to erlang:apply
Browse files Browse the repository at this point in the history
When a module has local apply/3 function, logging macros
do not work correctly due to "ambiguous call of overridden pre
R14 auto-imported BIF apply/3"
  • Loading branch information
max-au committed Oct 18, 2020
1 parent bdb8263 commit 09e1a36
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/kernel/include/logger.hrl
Expand Up @@ -46,7 +46,7 @@
-define(DO_LOG(Level,Args),
case logger:allow(Level,?MODULE) of
true ->
apply(logger,macro_log,[?LOCATION,Level|Args]);
erlang:apply(logger,macro_log,[?LOCATION,Level|Args]);
false ->
ok
end).
Expand Down
8 changes: 7 additions & 1 deletion lib/kernel/test/logger_SUITE.erl
Expand Up @@ -68,7 +68,7 @@ init_per_testcase(_TestCase, Config) ->
[{logger_config,PC}|Config].

end_per_testcase(Case, Config) ->
try apply(?MODULE,Case,[cleanup,Config])
try erlang:apply(?MODULE,Case,[cleanup,Config])
catch error:undef -> ok
end,
ok.
Expand Down Expand Up @@ -1408,3 +1408,9 @@ check_config(crash) ->
erlang:error({badmatch,3});
check_config(_) ->
ok.

%% this function is also a test. When logger.hrl used non-qualified
%% apply/3 call, any module that was implementing apply/3 could
%% not use any logging macro
apply(_Any, _Any, _Any) ->
ok.

0 comments on commit 09e1a36

Please sign in to comment.