Merge pull request #75 from martinsumner/mas-arraytype-i73
Mas arraytype i73
This commit is contained in:
commit
39fd3e5c87
3 changed files with 46 additions and 24 deletions
|
@ -327,21 +327,32 @@
|
|||
|
||||
|
||||
log(LogReference, Subs) ->
|
||||
{LogLevel, LogText} = lists:keyfind(LogReference, 1, ?LOGBASE),
|
||||
case lists:member(LogLevel, ?LOG_LEVEL) of
|
||||
log(LogReference, Subs, ?LOG_LEVEL).
|
||||
|
||||
log(LogRef, Subs, SupportedLogLevels) ->
|
||||
case lists:keyfind(LogRef, 1, ?LOGBASE) of
|
||||
{LogRef, {LogLevel, LogText}} ->
|
||||
case lists:member(LogLevel, SupportedLogLevels) of
|
||||
true ->
|
||||
io:format(format_time()
|
||||
++ " " ++ LogReference ++ " ~w "
|
||||
++ " " ++ LogRef ++ " ~w "
|
||||
++ LogText ++ "~n",
|
||||
[self()|Subs]);
|
||||
false ->
|
||||
ok
|
||||
end;
|
||||
false ->
|
||||
ok
|
||||
end.
|
||||
|
||||
|
||||
log_timer(LogReference, Subs, StartTime) ->
|
||||
{LogLevel, LogText} = lists:keyfind(LogReference, 1, ?LOGBASE),
|
||||
case lists:member(LogLevel, ?LOG_LEVEL) of
|
||||
log_timer(LogReference, Subs, StartTime, ?LOG_LEVEL).
|
||||
|
||||
log_timer(LogRef, Subs, StartTime, SupportedLogLevels) ->
|
||||
case lists:keyfind(LogRef, 1, ?LOGBASE) of
|
||||
{LogRef, {LogLevel, LogText}} ->
|
||||
case lists:member(LogLevel, SupportedLogLevels) of
|
||||
true ->
|
||||
MicroS = timer:now_diff(os:timestamp(), StartTime),
|
||||
{Unit, Time} = case MicroS of
|
||||
|
@ -351,12 +362,15 @@ log_timer(LogReference, Subs, StartTime) ->
|
|||
{"ms", MicroS div 1000}
|
||||
end,
|
||||
io:format(format_time()
|
||||
++ " " ++ LogReference ++ " ~w "
|
||||
++ " " ++ LogRef ++ " ~w "
|
||||
++ LogText
|
||||
++ " with time taken ~w " ++ Unit ++ "~n",
|
||||
[self()|Subs] ++ [Time]);
|
||||
false ->
|
||||
ok
|
||||
end;
|
||||
false ->
|
||||
ok
|
||||
end.
|
||||
|
||||
log_randomtimer(LogReference, Subs, StartTime, RandomProb) ->
|
||||
|
@ -577,4 +591,10 @@ head_timing_test() ->
|
|||
?assertMatch(3, lists:nth(1, dict:fetch(found_2, 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.
|
|
@ -245,7 +245,8 @@
|
|||
|
||||
-type penciller_options() :: #penciller_options{}.
|
||||
-type bookies_memory() :: {tuple()|empty_cache,
|
||||
array:array()|empty_array,
|
||||
% array:array()|empty_array,
|
||||
any()|empty_array, % Issue of type compatability with OTP16
|
||||
integer()|infinity,
|
||||
integer()}.
|
||||
-type pcl_state() :: #state{}.
|
||||
|
|
|
@ -43,7 +43,8 @@
|
|||
|
||||
-include_lib("eunit/include/eunit.hrl").
|
||||
|
||||
-type index_array() :: array:array().
|
||||
% -type index_array() :: array:array().
|
||||
-type index_array() :: any(). % To live with OTP16
|
||||
|
||||
%%%============================================================================
|
||||
%%% API
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue