From 96c1aa0041b368afceef0aef88e82a6c9f8e901d Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Fri, 31 Aug 2018 17:08:24 +0200 Subject: [logger] Remove encoding option from logger_formatter The encoding option was introduced in commit 270d909696a753af022df72a404c73f2895b4a02, to allow report callbacks to format according to a given encoding. There was, however, no connection between this encoding option, and the encoding of the device to which the logger handler was writing. Since a formatter is defined to return unicode:chardata(), and in order to avoid mismatch with the encoding of the device, the encoding option is now removed from the formatter. The handler itself must make sure that it does not write illegal data to its device. --- lib/kernel/doc/src/logger_chapter.xml | 11 +++++------ lib/kernel/doc/src/logger_formatter.xml | 7 ------- 2 files changed, 5 insertions(+), 13 deletions(-) (limited to 'lib/kernel/doc/src') diff --git a/lib/kernel/doc/src/logger_chapter.xml b/lib/kernel/doc/src/logger_chapter.xml index d58c4a4d42..26066d0777 100644 --- a/lib/kernel/doc/src/logger_chapter.xml +++ b/lib/kernel/doc/src/logger_chapter.xml @@ -208,12 +208,11 @@ coversion to a string:

fun((logger:report(),logger:report_cb_config()) -> unicode:chardata())
       
-

The fun must obey the encoding, depth - and chars_limit parameters provided in the second - argument, as the formatter can not do anything useful of these - parameters with the returned string. This variant is used when - the formatting of the report depends on the size and encoding - parameters.

+

The fun must obey the depth and chars_limit + parameters provided in the second argument, as the formatter + can not do anything useful of these parameters with the + returned string. This variant is used when the formatting of + the report depends on the size parameters.

Example, format string and arguments:

logger:error("The file does not exist: ~ts",[Filename])

Example, string:

diff --git a/lib/kernel/doc/src/logger_formatter.xml b/lib/kernel/doc/src/logger_formatter.xml index 5a060fd42b..24772fd6c4 100644 --- a/lib/kernel/doc/src/logger_formatter.xml +++ b/lib/kernel/doc/src/logger_formatter.xml @@ -82,13 +82,6 @@ in STDLIB.

Defaults to unlimited.

- encoding = - unicode:encoding() - -

This parameter must reflect the encoding of the device - that the handler prints to.

-

Defaults to utf8

-
legacy_header = boolean()

If set to true a header field is added to -- cgit v1.2.3 From d9e58a29f9194ea8b2d9e1bdcf5b89a9cc29f988 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Tue, 4 Sep 2018 14:30:49 +0200 Subject: [logger] Update doc about file options in logger_std_h --- lib/kernel/doc/src/logger_std_h.xml | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'lib/kernel/doc/src') diff --git a/lib/kernel/doc/src/logger_std_h.xml b/lib/kernel/doc/src/logger_std_h.xml index b526ed037d..fcd8189bae 100644 --- a/lib/kernel/doc/src/logger_std_h.xml +++ b/lib/kernel/doc/src/logger_std_h.xml @@ -59,13 +59,22 @@

This has the value standard_io, standard_error, {file,LogFileName}, or {file,LogFileName,LogFileOpts}.

+

If LogFileOpts is specified, it replaces the default + list of options used when opening the log file. The default + list is [raw,append,delayed_write]. One reason to do + so can be to change append to, for + example, write, ensuring that the old log is + truncated when a node is restarted. See the reference manual + for file:open/2 + for more information about file options.

+

Log files are always UTF-8 encoded. The encoding can not be + changed by setting the option {encoding,Encoding} + in LogFileOpts.

+

Notice that the standard handler does not have support for + circular logging. Use the disk_log handler, + logger_disk_log_h, + for this.

Defaults to standard_io.

-

It is recommended not to specify LogFileOpts unless absolutely - necessary. The default options used by the handler to open a file for logging are - raw, append, and delayed_write. Notice that the standard - handler does not have support for circular logging. Use the disk_log handler, - logger_disk_log_h, - for this.

filesync_repeat_interval @@ -73,12 +82,12 @@ a file sync operation to write buffered data to disk. The handler attempts the operation repeatedly, but only performs a new sync if something has actually been logged.

-

Defaults to 5000 milliseconds.

If no_repeat is set as value, the repeated file sync operation is disabled, and it is the operating system settings that determine how quickly or slowly data is written to disk. The user can also call the filesync/1 function to perform a file sync.

+

Defaults to 5000 milliseconds.

Other configuration parameters exist, to be used for customizing -- cgit v1.2.3 From a9a72da93e9b93a1d7ee9936b8e223545277480e Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Thu, 6 Sep 2018 13:51:49 +0200 Subject: [logger] Refactor, and add error detection for configuration --- lib/kernel/doc/src/logger.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/kernel/doc/src') diff --git a/lib/kernel/doc/src/logger.xml b/lib/kernel/doc/src/logger.xml index a4d6efa2d8..464c65ba76 100644 --- a/lib/kernel/doc/src/logger.xml +++ b/lib/kernel/doc/src/logger.xml @@ -527,7 +527,7 @@ start(_, []) -> Error -> Error end.

This reads the logger configuration parameter from - the my_all application and starts the configured + the my_app application and starts the configured handlers. The contents of the configuration use the same rules as the logger handler configuration. -- cgit v1.2.3 From a4ff9f378ae7008e268d1c2facd44d049be6e930 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Wed, 12 Sep 2018 14:37:02 +0200 Subject: [logger] Include single_line option to report_cb If the report callback function has two arguments, the second argument is a map with options to limit the size of the log event. To even allow a better formatting when the event shall be printed on a single line, the new option single_line is now included in this argument. --- lib/kernel/doc/src/logger_chapter.xml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'lib/kernel/doc/src') diff --git a/lib/kernel/doc/src/logger_chapter.xml b/lib/kernel/doc/src/logger_chapter.xml index 26066d0777..4a81cfa34a 100644 --- a/lib/kernel/doc/src/logger_chapter.xml +++ b/lib/kernel/doc/src/logger_chapter.xml @@ -209,10 +209,13 @@

fun((logger:report(),logger:report_cb_config()) -> unicode:chardata())
       

The fun must obey the depth and chars_limit - parameters provided in the second argument, as the formatter - can not do anything useful of these parameters with the - returned string. This variant is used when the formatting of - the report depends on the size parameters.

+ parameters provided in the second argument, as the formatter can + not do anything useful of these parameters with the returned + string. The extra data also contains a field named + single_line, indicating if the printed log message may + contain line breaks or not. This variant is used when the + formatting of the report depends on the size or single line + parameters.

Example, format string and arguments:

logger:error("The file does not exist: ~ts",[Filename])

Example, string:

-- cgit v1.2.3