Change log to keyfind
Save doing dict:to_list each call to log
This commit is contained in:
parent
92275cfc2f
commit
204a5a8caa
1 changed files with 4 additions and 4 deletions
|
@ -22,7 +22,7 @@
|
|||
-define(LOG_LEVEL, [info, warn, error, critical]).
|
||||
-define(SAMPLE_RATE, 16).
|
||||
|
||||
-define(LOGBASE, dict:from_list([
|
||||
-define(LOGBASE, [
|
||||
|
||||
{"G0001",
|
||||
{info, "Generic log point"}},
|
||||
|
@ -323,11 +323,11 @@
|
|||
++ "and max write time is ~w and max sync time is ~w"}},
|
||||
{"CDB18",
|
||||
{info, "Handled return and write of hashtable"}}
|
||||
])).
|
||||
]).
|
||||
|
||||
|
||||
log(LogReference, Subs) ->
|
||||
{LogLevel, LogText} = dict:fetch(LogReference, ?LOGBASE),
|
||||
{LogLevel, LogText} = lists:keyfind(LogReference, 1, ?LOGBASE),
|
||||
case lists:member(LogLevel, ?LOG_LEVEL) of
|
||||
true ->
|
||||
io:format(format_time()
|
||||
|
@ -340,7 +340,7 @@ log(LogReference, Subs) ->
|
|||
|
||||
|
||||
log_timer(LogReference, Subs, StartTime) ->
|
||||
{LogLevel, LogText} = dict:fetch(LogReference, ?LOGBASE),
|
||||
{LogLevel, LogText} = lists:keyfind(LogReference, 1, ?LOGBASE),
|
||||
case lists:member(LogLevel, ?LOG_LEVEL) of
|
||||
true ->
|
||||
MicroS = timer:now_diff(os:timestamp(), StartTime),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue