aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src/logger_disk_log_h.erl
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2018-10-03 12:21:23 +0200
committerSiri Hansen <[email protected]>2018-10-03 13:06:25 +0200
commit6fae4fbd3650366730d35988ee588c32848dbecc (patch)
treed204f1bf65439f6da5a3ec35e491bd4385752530 /lib/kernel/src/logger_disk_log_h.erl
parent1838418b9193140f6ba5f5716884b62aad7b662d (diff)
downloadotp-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_disk_log_h.erl')
-rw-r--r--lib/kernel/src/logger_disk_log_h.erl8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/kernel/src/logger_disk_log_h.erl b/lib/kernel/src/logger_disk_log_h.erl
index bb8b9f08a4..2a81458ec8 100644
--- a/lib/kernel/src/logger_disk_log_h.erl
+++ b/lib/kernel/src/logger_disk_log_h.erl
@@ -33,7 +33,8 @@
terminate/2, code_change/3]).
%% logger callbacks
--export([log/2, adding_handler/1, removing_handler/1, changing_config/3]).
+-export([log/2, adding_handler/1, removing_handler/1, changing_config/3,
+ filter_config/1]).
%% handler internal
-export([log_handler_info/4]).
@@ -247,6 +248,11 @@ log(LogEvent, Config = #{id := Name,
Bin = logger_h_common:log_to_binary(LogEvent, Config),
logger_h_common:call_cast_or_drop(Name, HPid, ModeTab, Bin).
+%%%-----------------------------------------------------------------
+%%% Remove internal fields from configuration
+filter_config(#{config:=HConfig}=Config) ->
+ Config#{config=>maps:without([handler_pid,mode_tab],HConfig)}.
+
%%%===================================================================
%%% gen_server callbacks
%%%===================================================================