From 224a42d658d3c08e3ce080fa8041c161e16f3863 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Thu, 20 Sep 2018 16:56:26 +0200 Subject: [logger] Add SetOrUpdate parameter to handler callback changing_config Since logger has now knowledge of the handler specific data ('config' field in the handler configuration map), it can not merge this data structure with default or old values upon configuration change. Instead, the handler callback changing_config must do this. Earlier, this callback did not reflect if the configuration change was initiated by a call to set_handler_config or update_handler_config, so the handler did not know if unspecified fields should get default values or the values from the existing configuration. To overcome this problem, the new parameter SetOrUpdate is added to this callback. If SetOrUpdate equals set, then default values should be used. If SetOrUpdate equals update, then existing configuration values should be used. --- lib/kernel/doc/src/logger_chapter.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/kernel/doc/src/logger_chapter.xml') diff --git a/lib/kernel/doc/src/logger_chapter.xml b/lib/kernel/doc/src/logger_chapter.xml index 4a81cfa34a..7e88f82dad 100644 --- a/lib/kernel/doc/src/logger_chapter.xml +++ b/lib/kernel/doc/src/logger_chapter.xml @@ -384,7 +384,7 @@ logger:debug(#{got => connection_request, id => Id, state => State},

In addition to the mandatory callback function log/2, a handler module can export the optional callback - functions adding_handler/1, changing_config/2 + functions adding_handler/1, changing_config/3 and removing_handler/1. See section Handler Callback Functions in the logger(3) manual page for @@ -1024,7 +1024,7 @@ ok adding_handler(Config) removing_handler(Config) - changing_config(OldConfig, NewConfig) + changing_config(SetOrUpdate, OldConfig, NewConfig)

When a handler is added, by for example a call to @@ -1045,7 +1045,7 @@ ok or logger:update_handler_config/2 is called, Logger - calls HModule:changing_config(OldConfig, NewConfig). If + calls HModule:changing_config(SetOrUpdate, OldConfig, NewConfig). If this function returns {ok,NewConfig1}, Logger writes NewConfig1 to the configuration database.

-- cgit v1.2.3