Skip to content

Commit

Permalink
Fix a regression about setting loglevel to 'none'
Browse files Browse the repository at this point in the history
  • Loading branch information
Vagabond committed Dec 20, 2012
1 parent 3162ad7 commit dd45905
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/lager_util.erl
Expand Up @@ -30,7 +30,7 @@
-include("lager.hrl").

levels() ->
[debug, info, notice, warning, error, critical, alert, emergency].
[debug, info, notice, warning, error, critical, alert, emergency, none].

level_to_num(debug) -> ?DEBUG;
level_to_num(info) -> ?INFO;
Expand Down Expand Up @@ -595,6 +595,8 @@ format_time_test_() ->
].

config_to_levels_test() ->
?assertEqual([none], config_to_levels('none')),
?assertEqual({mask, 0}, config_to_mask('none')),
?assertEqual([debug], config_to_levels('=debug')),
?assertEqual([debug], config_to_levels('<info')),
?assertEqual(levels() -- [debug], config_to_levels('!=debug')),
Expand All @@ -614,7 +616,15 @@ config_to_levels_test() ->
?assertEqual(levels() -- [debug], config_to_levels('!!!=debug')),
ok.

config_to_mask_test() ->
?assertEqual({mask, 0}, config_to_mask('none')),
?assertEqual({mask, ?DEBUG bor ?INFO bor ?NOTICE bor ?WARNING bor ?ERROR bor ?CRITICAL bor ?ALERT bor ?EMERGENCY}, config_to_mask('debug')),
?assertEqual({mask, ?WARNING bor ?ERROR bor ?CRITICAL bor ?ALERT bor ?EMERGENCY}, config_to_mask('warning')),
?assertEqual({mask, ?DEBUG bor ?NOTICE bor ?WARNING bor ?ERROR bor ?CRITICAL bor ?ALERT bor ?EMERGENCY}, config_to_mask('!=info')),
ok.

mask_to_levels_test() ->
?assertEqual([], mask_to_levels(0)),
?assertEqual([debug], mask_to_levels(2#10000000)),
?assertEqual([debug, info], mask_to_levels(2#11000000)),
?assertEqual([debug, info, emergency], mask_to_levels(2#11000001)),
Expand Down

0 comments on commit dd45905

Please sign in to comment.