Resolve dialyzer warnings
Botched switch to leveled_log in list - so reoslved dialyzer warnings
This commit is contained in:
parent
32612dfe4a
commit
569b498727
1 changed files with 42 additions and 22 deletions
|
@ -327,34 +327,48 @@
|
||||||
|
|
||||||
|
|
||||||
log(LogReference, Subs) ->
|
log(LogReference, Subs) ->
|
||||||
{LogLevel, LogText} = lists:keyfind(LogReference, 1, ?LOGBASE),
|
log(LogReference, Subs, ?LOG_LEVEL).
|
||||||
case lists:member(LogLevel, ?LOG_LEVEL) of
|
|
||||||
true ->
|
log(LogRef, Subs, SupportedLogLevels) ->
|
||||||
io:format(format_time()
|
case lists:keyfind(LogRef, 1, ?LOGBASE) of
|
||||||
++ " " ++ LogReference ++ " ~w "
|
{LogRef, {LogLevel, LogText}} ->
|
||||||
++ LogText ++ "~n",
|
case lists:member(LogLevel, SupportedLogLevels) of
|
||||||
[self()|Subs]);
|
true ->
|
||||||
|
io:format(format_time()
|
||||||
|
++ " " ++ LogRef ++ " ~w "
|
||||||
|
++ LogText ++ "~n",
|
||||||
|
[self()|Subs]);
|
||||||
|
false ->
|
||||||
|
ok
|
||||||
|
end;
|
||||||
false ->
|
false ->
|
||||||
ok
|
ok
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
log_timer(LogReference, Subs, StartTime) ->
|
log_timer(LogReference, Subs, StartTime) ->
|
||||||
{LogLevel, LogText} = lists:keyfind(LogReference, 1, ?LOGBASE),
|
log_timer(LogReference, Subs, StartTime, ?LOG_LEVEL).
|
||||||
case lists:member(LogLevel, ?LOG_LEVEL) of
|
|
||||||
true ->
|
log_timer(LogRef, Subs, StartTime, SupportedLogLevels) ->
|
||||||
MicroS = timer:now_diff(os:timestamp(), StartTime),
|
case lists:keyfind(LogRef, 1, ?LOGBASE) of
|
||||||
{Unit, Time} = case MicroS of
|
{LogRef, {LogLevel, LogText}} ->
|
||||||
MicroS when MicroS < 1000 ->
|
case lists:member(LogLevel, SupportedLogLevels) of
|
||||||
{"microsec", MicroS};
|
true ->
|
||||||
MicroS ->
|
MicroS = timer:now_diff(os:timestamp(), StartTime),
|
||||||
{"ms", MicroS div 1000}
|
{Unit, Time} = case MicroS of
|
||||||
end,
|
MicroS when MicroS < 1000 ->
|
||||||
io:format(format_time()
|
{"microsec", MicroS};
|
||||||
++ " " ++ LogReference ++ " ~w "
|
MicroS ->
|
||||||
++ LogText
|
{"ms", MicroS div 1000}
|
||||||
++ " with time taken ~w " ++ Unit ++ "~n",
|
end,
|
||||||
[self()|Subs] ++ [Time]);
|
io:format(format_time()
|
||||||
|
++ " " ++ LogRef ++ " ~w "
|
||||||
|
++ LogText
|
||||||
|
++ " with time taken ~w " ++ Unit ++ "~n",
|
||||||
|
[self()|Subs] ++ [Time]);
|
||||||
|
false ->
|
||||||
|
ok
|
||||||
|
end;
|
||||||
false ->
|
false ->
|
||||||
ok
|
ok
|
||||||
end.
|
end.
|
||||||
|
@ -577,4 +591,10 @@ head_timing_test() ->
|
||||||
?assertMatch(3, lists:nth(1, dict:fetch(found_2, D))),
|
?assertMatch(3, lists:nth(1, dict:fetch(found_2, D))),
|
||||||
?assertMatch(1, lists:nth(1, dict:fetch(found_lower, D))).
|
?assertMatch(1, lists:nth(1, dict:fetch(found_lower, D))).
|
||||||
|
|
||||||
|
log_warn_test() ->
|
||||||
|
ok = log("G0001", [], [warn, error]),
|
||||||
|
ok = log("G8888", [], [info, warn, error]),
|
||||||
|
ok = log_timer("G0001", [], os:timestamp(), [warn, error]),
|
||||||
|
ok = log_timer("G8888", [], os:timestamp(), [info, warn, error]).
|
||||||
|
|
||||||
-endif.
|
-endif.
|
Loading…
Add table
Add a link
Reference in a new issue