aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2019-08-23 09:44:16 +0200
committerLukas Larsson <[email protected]>2019-08-23 09:44:16 +0200
commitae6cd4c5749c6439d19fb6ace04501664b192cc3 (patch)
tree95990ce1fcdb32d0ea90c8aac0b9e3c730a551af
parent0b059106055e33241c4d259166bf892253814fbb (diff)
parent681551f849be45dfc848366cc879b0f96bff1479 (diff)
downloadotp-ae6cd4c5749c6439d19fb6ace04501664b192cc3.tar.gz
otp-ae6cd4c5749c6439d19fb6ace04501664b192cc3.tar.bz2
otp-ae6cd4c5749c6439d19fb6ace04501664b192cc3.zip
Merge branch 'maint'
-rw-r--r--lib/kernel/src/logger.erl10
-rw-r--r--lib/kernel/src/logger_internal.hrl7
-rw-r--r--lib/kernel/test/logger_SUITE.erl2
3 files changed, 12 insertions, 7 deletions
diff --git a/lib/kernel/src/logger.erl b/lib/kernel/src/logger.erl
index 38bd2f481c..fd02cf67bf 100644
--- a/lib/kernel/src/logger.erl
+++ b/lib/kernel/src/logger.erl
@@ -600,11 +600,11 @@ get_module_level() ->
%%%-----------------------------------------------------------------
%%% Misc
-spec compare_levels(Level1,Level2) -> eq | gt | lt when
- Level1 :: level(),
- Level2 :: level().
-compare_levels(Level,Level) when ?IS_LEVEL(Level) ->
+ Level1 :: level() | all | none,
+ Level2 :: level() | all | none.
+compare_levels(Level,Level) when ?IS_LEVEL_ALL(Level) ->
eq;
-compare_levels(Level1,Level2) when ?IS_LEVEL(Level1), ?IS_LEVEL(Level2) ->
+compare_levels(Level1,Level2) when ?IS_LEVEL_ALL(Level1), ?IS_LEVEL_ALL(Level2) ->
Int1 = logger_config:level_to_int(Level1),
Int2 = logger_config:level_to_int(Level2),
if Int1 < Int2 -> gt;
@@ -950,7 +950,7 @@ get_logger_type(Env) ->
get_logger_level() ->
case application:get_env(kernel,logger_level,info) of
- Level when ?IS_LEVEL(Level); Level=:=all; Level=:=none ->
+ Level when ?IS_LEVEL_ALL(Level) ->
Level;
Level ->
throw({logger_level, Level})
diff --git a/lib/kernel/src/logger_internal.hrl b/lib/kernel/src/logger_internal.hrl
index e53922e5d3..c2b2d419e7 100644
--- a/lib/kernel/src/logger_internal.hrl
+++ b/lib/kernel/src/logger_internal.hrl
@@ -86,7 +86,12 @@
L=:=warning orelse
L=:=notice orelse
L=:=info orelse
- L=:=debug)).
+ L=:=debug )).
+
+-define(IS_LEVEL_ALL(L),
+ ?IS_LEVEL(L) orelse
+ L=:=all orelse
+ L=:=none ).
-define(IS_MSG(Msg),
((is_tuple(Msg) andalso tuple_size(Msg)==2)
diff --git a/lib/kernel/test/logger_SUITE.erl b/lib/kernel/test/logger_SUITE.erl
index 035e5d8974..f8f3d27778 100644
--- a/lib/kernel/test/logger_SUITE.erl
+++ b/lib/kernel/test/logger_SUITE.erl
@@ -880,7 +880,7 @@ other_node(cleanup,_Config) ->
ok.
compare_levels(_Config) ->
- Levels = [emergency,alert,critical,error,warning,notice,info,debug],
+ Levels = [none,emergency,alert,critical,error,warning,notice,info,debug,all],
ok = compare(Levels),
{error,badarg} = ?TRY(logger:compare_levels(bad,bad)),
{error,badarg} = ?TRY(logger:compare_levels({bad},notice)),