aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test/logger_SUITE.erl
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2018-10-03 13:00:41 +0200
committerSiri Hansen <[email protected]>2018-10-03 13:00:41 +0200
commit1838418b9193140f6ba5f5716884b62aad7b662d (patch)
treeb07b2ce785020956154171f7e0ca03ec6965f789 /lib/kernel/test/logger_SUITE.erl
parenta006915a4f3ebbff84ccc83fb87f0283ebe49e8e (diff)
downloadotp-1838418b9193140f6ba5f5716884b62aad7b662d.tar.gz
otp-1838418b9193140f6ba5f5716884b62aad7b662d.tar.bz2
otp-1838418b9193140f6ba5f5716884b62aad7b662d.zip
[logger] Start using handler callback changing_config/3 in built-in handlers
The new parameter to this function, SetOrUpdate, indicates how unspecified configuration data fields shall be set. The rule is that if SetOrUpdate equals set, then default values shall be used, and if SetOrUpdate equals update, then existing configuration values shall be used. Consequently, these examples now apply to logger_std_h and logger_disk_log_h: set_handler_config(default, config, #{sync_mode_qlen => 20}) sets the value of sync_mode_qlen to 20, and resets all other (writable) fields in the config map to their default values. update_handler_config(default, config, #{sync_mode_qlen => 20}) sets the value of sync_mode_qlen to 20, and leaves all other fields in the config map unchanged.
Diffstat (limited to 'lib/kernel/test/logger_SUITE.erl')
-rw-r--r--lib/kernel/test/logger_SUITE.erl12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/kernel/test/logger_SUITE.erl b/lib/kernel/test/logger_SUITE.erl
index b7ccba8e70..d831d0d108 100644
--- a/lib/kernel/test/logger_SUITE.erl
+++ b/lib/kernel/test/logger_SUITE.erl
@@ -246,6 +246,18 @@ change_config(_Config) ->
{ok,C4} = logger:get_handler_config(h1),
C4 = C3#{custom:=new_custom},
+ %% Change handler config: Id and module can not be changed
+ {error,{illegal_config_change,Old,New}} =
+ logger:set_handler_config(h1,id,newid),
+ %% Check that only the faulty field is included in return
+ [{id,h1}] = maps:to_list(Old),
+ [{id,newid}] = maps:to_list(New),
+ %% Check that both fields are included when both are changed
+ {error,{illegal_config_change,
+ #{id:=h1,module:=?MODULE},
+ #{id:=newid,module:=newmodule}}} =
+ logger:set_handler_config(h1,#{id=>newid,module=>newmodule}),
+
%% Change primary config: Single key
PConfig0 = logger:get_primary_config(),
ok = logger:set_primary_config(level,warning),