aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2018-10-03 12:41:28 +0200
committerSiri Hansen <[email protected]>2018-10-03 12:58:15 +0200
commita006915a4f3ebbff84ccc83fb87f0283ebe49e8e (patch)
tree4615eecd43b30cc4a9468d6f7e83348ce021248f /lib/kernel/src
parent224a42d658d3c08e3ce080fa8041c161e16f3863 (diff)
downloadotp-a006915a4f3ebbff84ccc83fb87f0283ebe49e8e.tar.gz
otp-a006915a4f3ebbff84ccc83fb87f0283ebe49e8e.tar.bz2
otp-a006915a4f3ebbff84ccc83fb87f0283ebe49e8e.zip
[logger] Add update_handler_config/3
This function is similar to set_handler_config/3, but calls the handler callback changing_config/3 with the first parameter SetOrUpdate=update.
Diffstat (limited to 'lib/kernel/src')
-rw-r--r--lib/kernel/src/logger.erl26
-rw-r--r--lib/kernel/src/logger_server.erl11
2 files changed, 35 insertions, 2 deletions
diff --git a/lib/kernel/src/logger.erl b/lib/kernel/src/logger.erl
index 752dd8d493..3ffa8a0c4e 100644
--- a/lib/kernel/src/logger.erl
+++ b/lib/kernel/src/logger.erl
@@ -43,7 +43,8 @@
get_module_level/0, get_module_level/1,
set_primary_config/1, set_primary_config/2,
set_handler_config/2, set_handler_config/3,
- update_primary_config/1, update_handler_config/2,
+ update_primary_config/1,
+ update_handler_config/2, update_handler_config/3,
update_formatter_config/2, update_formatter_config/3,
get_primary_config/0, get_handler_config/1,
get_handler_config/0, get_handler_ids/0, get_config/0,
@@ -423,6 +424,29 @@ set_handler_config(HandlerId,Config) ->
update_primary_config(Config) ->
logger_server:update_config(primary,Config).
+-spec update_handler_config(HandlerId,level,Level) -> Return when
+ HandlerId :: handler_id(),
+ Level :: level() | all | none,
+ Return :: ok | {error,term()};
+ (HandlerId,filter_default,FilterDefault) -> Return when
+ HandlerId :: handler_id(),
+ FilterDefault :: log | stop,
+ Return :: ok | {error,term()};
+ (HandlerId,filters,Filters) -> Return when
+ HandlerId :: handler_id(),
+ Filters :: [{filter_id(),filter()}],
+ Return :: ok | {error,term()};
+ (HandlerId,formatter,Formatter) -> Return when
+ HandlerId :: handler_id(),
+ Formatter :: {module(), formatter_config()},
+ Return :: ok | {error,term()};
+ (HandlerId,config,Config) -> Return when
+ HandlerId :: handler_id(),
+ Config :: term(),
+ Return :: ok | {error,term()}.
+update_handler_config(HandlerId,Key,Value) ->
+ logger_server:update_config(HandlerId,Key,Value).
+
-spec update_handler_config(HandlerId,Config) -> ok | {error,term()} when
HandlerId :: handler_id(),
Config :: handler_config().
diff --git a/lib/kernel/src/logger_server.erl b/lib/kernel/src/logger_server.erl
index a14de2664e..9e043f9362 100644
--- a/lib/kernel/src/logger_server.erl
+++ b/lib/kernel/src/logger_server.erl
@@ -27,7 +27,8 @@
add_filter/2, remove_filter/2,
set_module_level/2, unset_module_level/0,
unset_module_level/1, cache_module_level/1,
- set_config/2, set_config/3, update_config/2,
+ set_config/2, set_config/3,
+ update_config/2, update_config/3,
update_formatter_config/2]).
%% gen_server callbacks
@@ -120,6 +121,14 @@ set_config(Owner,Config) ->
Error
end.
+update_config(Owner,Key,Value) ->
+ case sanity_check(Owner,Key,Value) of
+ ok ->
+ call({change_config,update,Owner,Key,Value});
+ Error ->
+ Error
+ end.
+
update_config(Owner, Config) ->
case sanity_check(Owner,Config) of
ok ->