Implement persistent traces in config file
diff --git a/src/lager_app.erl b/src/lager_app.erl
index 99ecd4f..68a90c0 100644
--- a/src/lager_app.erl
+++ b/src/lager_app.erl
@@ -60,6 +60,8 @@
_ = [supervisor:start_child(lager_handler_watcher_sup, [lager_event, Module, Config]) ||
{Module, Config} <- expand_handlers(Handlers)],
+ ok = add_configured_traces(),
+
%% mask the messages we have no use for
lager:update_loglevel_config(),
@@ -118,6 +120,20 @@
expand_handlers([H|T]) ->
[H | expand_handlers(T)].
+add_configured_traces() ->
+ Traces = case application:get_env(lager, traces) of
+ undefined ->
+ [];
+ {ok, TraceVal} ->
+ TraceVal
+ end,
+
+ lists:foreach(fun({Handler, Filter, Level}) ->
+ {ok, _} = lager:trace(Handler, Filter, Level)
+ end,
+ Traces),
+ ok.
+
maybe_make_handler_id(Mod, Config) ->
%% Allow the backend to generate a gen_event handler id, if it wants to.
%% We don't use erlang:function_exported here because that requires the module