aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-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)),