Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

add whitelist of error_logger handlers not to delete when error_logger_r... #104

Merged
merged 1 commit into from

2 participants

@tsloughter

...edirect is true

src/lager_app.erl
((16 lines not shown))
- end,
+ SavedHandlers =
+ case application:get_env(lager, error_logger_redirect) of
+ {ok, false} ->
+ [];
+ _ ->
+ case application:get_env(lager, error_logger_whitelist) of
+ undefined ->
+ WhiteList = [];
+ {ok, WhiteList} ->
+ WhiteList
+ end,
+
+ case supervisor:start_child(lager_handler_watcher_sup, [error_logger, error_logger_lager_h, []]) of
+ {ok, _} ->
+ %% Should we allow user to whitelist handlers to not be removed?
@Vagabond Collaborator

comment seems outdated now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Vagabond
Collaborator

Fix the comment (add a test if you feel like being nice) and I'll merge.

@Vagabond Vagabond merged commit 3162ad7 into basho:master

1 check passed

Details default The Travis build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 13, 2012
  1. add whitelist of error_logger handlers not to delete when error_logge…

    Tristan Sloughter authored
    …r_redirect is true
This page is out of date. Refresh to see the latest.
Showing with 20 additions and 13 deletions.
  1. +20 −13 src/lager_app.erl
View
33 src/lager_app.erl
@@ -52,19 +52,26 @@ start(_StartType, _StartArgs) ->
{_, Traces} = lager_config:get(loglevel),
lager_config:set(loglevel, {MinLog, Traces}),
- SavedHandlers = case application:get_env(lager, error_logger_redirect) of
- {ok, false} ->
- [];
- _ ->
- case supervisor:start_child(lager_handler_watcher_sup, [error_logger, error_logger_lager_h, []]) of
- {ok, _} ->
- %% Should we allow user to whitelist handlers to not be removed?
- [begin error_logger:delete_report_handler(X), X end ||
- X <- gen_event:which_handlers(error_logger) -- [error_logger_lager_h]];
- {error, _} ->
- []
- end
- end,
+ SavedHandlers =
+ case application:get_env(lager, error_logger_redirect) of
+ {ok, false} ->
+ [];
+ _ ->
+ case application:get_env(lager, error_logger_whitelist) of
+ undefined ->
+ WhiteList = [];
+ {ok, WhiteList} ->
+ WhiteList
+ end,
+
+ case supervisor:start_child(lager_handler_watcher_sup, [error_logger, error_logger_lager_h, []]) of
+ {ok, _} ->
+ [begin error_logger:delete_report_handler(X), X end ||
+ X <- gen_event:which_handlers(error_logger) -- [error_logger_lager_h | WhiteList]];
+ {error, _} ->
+ []
+ end
+ end,
{ok, Pid, SavedHandlers}.
Something went wrong with that request. Please try again.