diff options
author | Siri Hansen <[email protected]> | 2018-10-03 12:21:23 +0200 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2018-10-03 13:06:25 +0200 |
commit | 6fae4fbd3650366730d35988ee588c32848dbecc (patch) | |
tree | d204f1bf65439f6da5a3ec35e491bd4385752530 /lib/kernel/src/logger_h_common.erl | |
parent | 1838418b9193140f6ba5f5716884b62aad7b662d (diff) | |
download | otp-6fae4fbd3650366730d35988ee588c32848dbecc.tar.gz otp-6fae4fbd3650366730d35988ee588c32848dbecc.tar.bz2 otp-6fae4fbd3650366730d35988ee588c32848dbecc.zip |
[logger] Add handler callback filter_config/1
This function is called when a logger API function for fetching
handler configuration is called. The point is to allow the handler to
remove internal data fields that it might have stored in the
configuration database, before returning the handler configuration to
the caller.
An example of such internal data are the 'handler_pid' and 'mode_tab'
fields that logger_std_h and logger_disk_log_h store in their
configuration maps.
Diffstat (limited to 'lib/kernel/src/logger_h_common.erl')
-rw-r--r-- | lib/kernel/src/logger_h_common.erl | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/kernel/src/logger_h_common.erl b/lib/kernel/src/logger_h_common.erl index 38ac7d8ffc..94c640cb92 100644 --- a/lib/kernel/src/logger_h_common.erl +++ b/lib/kernel/src/logger_h_common.erl @@ -306,8 +306,11 @@ stop_or_restart(Name, {shutdown,Reason={overloaded,_Name,_QLen,_Mem}}, exit(HandlerPid, kill) end, case ConfigResult of - {ok,#{module:=HMod}=HConfig} when is_integer(RestartAfter) -> + {ok,#{module:=HMod}=HConfig0} when is_integer(RestartAfter) -> _ = logger:remove_handler(Name), + HConfig = try HMod:filter_config(HConfig0) + catch _:_ -> HConfig0 + end, _ = timer:apply_after(RestartAfter, logger, add_handler, [Name,HMod,HConfig]); {ok,_} -> |