aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2018-05-14 20:27:55 +0200
committerLukas Larsson <[email protected]>2018-05-21 17:43:53 +0200
commit5d49f8a25005945b7260facc1a985c294746616b (patch)
tree34b529189098cbf29a3e76be797d46ea67eb377d /lib/kernel/src
parentd29fca17a0c053fca2e5961fb146e9aeefb55aa9 (diff)
downloadotp-5d49f8a25005945b7260facc1a985c294746616b.tar.gz
otp-5d49f8a25005945b7260facc1a985c294746616b.tar.bz2
otp-5d49f8a25005945b7260facc1a985c294746616b.zip
Add update_logger_config/1 and update_handler_config/2 to logger
Diffstat (limited to 'lib/kernel/src')
-rw-r--r--lib/kernel/src/logger.erl12
-rw-r--r--lib/kernel/src/logger_server.erl15
2 files changed, 22 insertions, 5 deletions
diff --git a/lib/kernel/src/logger.erl b/lib/kernel/src/logger.erl
index 2c7466fdf6..a839f97e62 100644
--- a/lib/kernel/src/logger.erl
+++ b/lib/kernel/src/logger.erl
@@ -40,6 +40,7 @@
set_module_level/2, reset_module_level/1,
set_logger_config/1, set_logger_config/2,
set_handler_config/2, set_handler_config/3,
+ update_logger_config/1, update_handler_config/2,
get_logger_config/0, get_handler_config/1,
add_handlers/1]).
@@ -361,6 +362,17 @@ set_handler_config(HandlerId,Key,Value) ->
set_handler_config(HandlerId,Config) ->
logger_server:set_config(HandlerId,Config).
+-spec update_logger_config(Config) -> ok | {error,term()} when
+ Config :: config().
+update_logger_config(Config) ->
+ logger_server:update_config(logger,Config).
+
+-spec update_handler_config(HandlerId,Config) -> ok | {error,term()} when
+ HandlerId :: handler_id(),
+ Config :: config().
+update_handler_config(HandlerId,Config) ->
+ logger_server:update_config(HandlerId,Config).
+
-spec get_logger_config() -> {ok,Config} when
Config :: config().
get_logger_config() ->
diff --git a/lib/kernel/src/logger_server.erl b/lib/kernel/src/logger_server.erl
index bd0c325f2b..275b9c476f 100644
--- a/lib/kernel/src/logger_server.erl
+++ b/lib/kernel/src/logger_server.erl
@@ -27,7 +27,7 @@
add_filter/2, remove_filter/2,
set_module_level/2, reset_module_level/1,
cache_module_level/1,
- set_config/2, set_config/3]).
+ set_config/2, set_config/3, update_config/2]).
%% gen_server callbacks
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
@@ -92,10 +92,7 @@ cache_module_level(Module) ->
set_config(Owner,Key,Value) ->
- case sanity_check(Owner,Key,Value) of
- ok -> call({update_config,Owner,#{Key=>Value}});
- Error -> Error
- end.
+ update_config(Owner,#{Key=>Value}).
set_config(Owner,Config0) ->
case sanity_check(Owner,Config0) of
@@ -106,6 +103,14 @@ set_config(Owner,Config0) ->
Error
end.
+update_config(Owner, Config) ->
+ case sanity_check(Owner,Config) of
+ ok ->
+ call({update_config,Owner,Config});
+ Error ->
+ Error
+ end.
+
%%%===================================================================
%%% gen_server callbacks
%%%===================================================================