Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixing the issue #159 #160

Open
wants to merge 6 commits into from
Commits on Nov 26, 2012
  1. @lukyanov
Commits on Nov 28, 2012
  1. @lukyanov
Commits on Jul 8, 2013
  1. @supersasha
Commits on Jul 9, 2013
  1. @supersasha
  2. @supersasha

    Revert "Specify node in the default formatter"

    supersasha authored
    This reverts commit 6d7d1cc.
Commits on Aug 2, 2013
  1. @alvelcom
This page is out of date. Refresh to see the latest.
Showing with 25 additions and 23 deletions.
  1. +2 −2 src/lager_app.erl
  2. +23 −21 src/lager_util.erl
View
4 src/lager_app.erl
@@ -62,6 +62,8 @@ start(_StartType, _StartArgs) ->
throw({error, bad_config})
end,
+ lager_util:trace_filter(none),
+
Handlers = case application:get_env(lager, handlers) of
undefined ->
[{lager_console_backend, info},
@@ -113,8 +115,6 @@ start(_StartType, _StartArgs) ->
end
end,
- lager_util:trace_filter(none),
-
{ok, Pid, SavedHandlers}.
View
44 src/lager_util.erl
@@ -388,20 +388,17 @@ validate_trace({Filter, Level, Destination}) when is_tuple(Filter); is_list(Filt
validate_trace(_) ->
{error, invalid_trace}.
-validate_trace_filter(Filter) when is_tuple(Filter), is_atom(element(1, Filter)) =:= false ->
- false;
-validate_trace_filter(Filter) ->
- case lists:all(fun({Key, '*'}) when is_atom(Key) -> true;
- ({Key, _Value}) when is_atom(Key) -> true;
- ({Key, '=', _Value}) when is_atom(Key) -> true;
- ({Key, '<', _Value}) when is_atom(Key) -> true;
- ({Key, '>', _Value}) when is_atom(Key) -> true;
- (_) -> false end, Filter) of
- true ->
- true;
- _ ->
- false
- end.
+validate_trace_filter(Filter) when is_list(Filter) ->
+ lists:all(fun validate_trace_filter/1, Filter);
+validate_trace_filter({Key, '*'}) when is_atom(Key) -> true;
+validate_trace_filter({any, L}) when is_list(L) -> lists:all(fun validate_trace_filter/1, L);
+validate_trace_filter({all, L}) when is_list(L) -> lists:all(fun validate_trace_filter/1, L);
+validate_trace_filter({null, Bool}) when is_boolean(Bool) -> true;
+validate_trace_filter({Key, _Value}) when is_atom(Key) -> true;
+validate_trace_filter({Key, '=', _Value}) when is_atom(Key) -> true;
+validate_trace_filter({Key, '<', _Value}) when is_atom(Key) -> true;
+validate_trace_filter({Key, '>', _Value}) when is_atom(Key) -> true;
+validate_trace_filter(_) -> false.
trace_all(Query) ->
glc:all(trace_acc(Query)).
@@ -413,18 +410,23 @@ trace_acc(Query) ->
trace_acc(Query, []).
trace_acc([], Acc) ->
- lists:reverse(Acc);
+ lists:reverse(Acc);
+trace_acc([{any, L}|T], Acc) ->
+ trace_acc(T, [glc:any(L)|Acc]);
+trace_acc([{all, L}|T], Acc) ->
+ trace_acc(T, [glc:all(L)|Acc]);
+trace_acc([{null, Bool}|T], Acc) ->
+ trace_acc(T, [glc:null(Bool)|Acc]);
trace_acc([{Key, '*'}|T], Acc) ->
- trace_acc(T, [glc:wc(Key)|Acc]);
+ trace_acc(T, [glc:wc(Key)|Acc]);
trace_acc([{Key, Val}|T], Acc) ->
- trace_acc(T, [glc:eq(Key, Val)|Acc]);
+ trace_acc(T, [glc:eq(Key, Val)|Acc]);
trace_acc([{Key, '=', Val}|T], Acc) ->
- trace_acc(T, [glc:eq(Key, Val)|Acc]);
+ trace_acc(T, [glc:eq(Key, Val)|Acc]);
trace_acc([{Key, '>', Val}|T], Acc) ->
- trace_acc(T, [glc:gt(Key, Val)|Acc]);
+ trace_acc(T, [glc:gt(Key, Val)|Acc]);
trace_acc([{Key, '<', Val}|T], Acc) ->
- trace_acc(T, [glc:lt(Key, Val)|Acc]).
-
+ trace_acc(T, [glc:lt(Key, Val)|Acc]).
check_traces(_, _, [], Acc) ->
lists:flatten(Acc);
Something went wrong with that request. Please try again.