Browse Source

Move the extra sink argument down a layer so that reinstalls work properly

pull/264/head
John R. Daily 10 years ago
parent
commit
daf3fdeb02
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      src/lager_handler_watcher.erl

+ 3
- 3
src/lager_handler_watcher.erl View File

@ -48,10 +48,10 @@ start(Sink, Module, Config) ->
gen_server:start(?MODULE, [Sink, Module, Config], []). gen_server:start(?MODULE, [Sink, Module, Config], []).
init([Sink, Module, Config]) when is_list(Config) -> init([Sink, Module, Config]) when is_list(Config) ->
install_handler(Sink, Module, [{sink, Sink}|Config]),
install_handler(Sink, Module, Config),
{ok, #state{sink=Sink, module=Module, config=Config}}; {ok, #state{sink=Sink, module=Module, config=Config}};
init([Sink, Module, Config]) -> init([Sink, Module, Config]) ->
install_handler(Sink, Module, [{sink, Sink}]++[Config]),
install_handler(Sink, Module, [Config]),
{ok, #state{sink=Sink, module=Module, config=Config}}. {ok, #state{sink=Sink, module=Module, config=Config}}.
handle_call(_Call, _From, State) -> handle_call(_Call, _From, State) ->
@ -92,7 +92,7 @@ code_change(_OldVsn, State, _Extra) ->
%% internal %% internal
install_handler(Sink, Module, Config) -> install_handler(Sink, Module, Config) ->
case gen_event:add_sup_handler(Sink, Module, Config) of
case gen_event:add_sup_handler(Sink, Module, [{sink, Sink}|Config]) of
ok -> ok ->
?INT_LOG(debug, "Lager installed handler ~p into ~p", [Module, Sink]), ?INT_LOG(debug, "Lager installed handler ~p into ~p", [Module, Sink]),
lager:update_loglevel_config(Sink), lager:update_loglevel_config(Sink),

Loading…
Cancel
Save