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,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.
|
|
@ -245,7 +245,8 @@
|
||||||
|
|
||||||
-type penciller_options() :: #penciller_options{}.
|
-type penciller_options() :: #penciller_options{}.
|
||||||
-type bookies_memory() :: {tuple()|empty_cache,
|
-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()|infinity,
|
||||||
integer()}.
|
integer()}.
|
||||||
-type pcl_state() :: #state{}.
|
-type pcl_state() :: #state{}.
|
||||||
|
|
|
@ -43,7 +43,8 @@
|
||||||
|
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-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
|
%%% API
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue