Skip to content
This repository has been archived by the owner. It is now read-only.
Browse files
Get lager event handlers from gen_event
The existing mechanism for getting lager_event's handlers incorrectly
uses the data structure returned by application:get_env, which is a
configuration defined in sys.config. The actual lager_event handler
list is obtained directly from gen_event.

  • Loading branch information
jaydoane committed Mar 17, 2016
1 parent b2a0471 commit 3c4823facbeb52a8f539ea2cf04568c9e8cd4980
Showing 1 changed file with 3 additions and 3 deletions.
@@ -64,9 +64,9 @@ emergency(Fmt, Args) ->

-spec set_level(atom()) -> ok.
set_level(Level) ->
{ok, Handlers} = application:get_env(lager, handlers),
lists:foreach(fun({Handler, _}) ->
lager:set_loglevel(Handler, Level)
Handlers = gen_event:which_handlers(lager_event),
lists:foreach(fun(Handler) ->
ok = lager:set_loglevel(Handler, Level)
end, Handlers).

0 comments on commit 3c4823f

Please sign in to comment.