Resolve coverage gaps

logs should always at least have a log_level defined which is in the ?LOG_LEVELS - so the final case of

`-is_active_level([]   , _, _) -> false.`

is unnecessary (even if a bad log level is passed in).

correct Bucket and Key definition to hit expected eunit test cases in leveled_pmem
This commit is contained in:
Martin Sumner 2018-12-11 22:25:37 +00:00
parent 672cfd4fcd
commit 7a876066e2
2 changed files with 8 additions and 4 deletions

View file

@ -489,8 +489,7 @@ should_i_log(LogLevel, Levels, LogRef) ->
is_active_level([L|_], L, _) -> true;
is_active_level([L|_], _, L) -> false;
is_active_level([_|T], C, L) -> is_active_level(T, C, L);
is_active_level([] , _, _) -> false.
is_active_level([_|T], C, L) -> is_active_level(T, C, L).
log_timer(LogReference, Subs, StartTime) ->
log_timer(LogReference, Subs, StartTime, ?LOG_LEVELS).
@ -572,4 +571,9 @@ shouldilog_test() ->
ok = set_loglevel(info),
?assertMatch(false, should_i_log(debug, ?LOG_LEVELS, "D0001")).
badloglevel_test() ->
% Set a bad log level - and everything logs
?assertMatch(true, is_active_level(?LOG_LEVELS, debug, unsupported)),
?assertMatch(true, is_active_level(?LOG_LEVELS, critical, unsupported)).
-endif.