From de2965827bfb903dcfcd0a97603548b2f8e3a807 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Wed, 2 May 2018 18:55:10 +0200 Subject: Change return type from logger_formatter:format/2 This used to be string() is now changed to unicode:chardata(). --- lib/kernel/doc/src/logger_chapter.xml | 22 ++++------------------ lib/kernel/src/logger_formatter.erl | 5 ++--- 2 files changed, 6 insertions(+), 21 deletions(-) (limited to 'lib/kernel') diff --git a/lib/kernel/doc/src/logger_chapter.xml b/lib/kernel/doc/src/logger_chapter.xml index 78d6f46c95..36f5f6dea3 100644 --- a/lib/kernel/doc/src/logger_chapter.xml +++ b/lib/kernel/doc/src/logger_chapter.xml @@ -157,7 +157,7 @@

A formatter is defined as a module exporting the following function:

- format(Log,Extra) -> string() + format(Log,Extra) -> unicode:chardata()

The formatter plugin is called by each handler, and the returned string can be printed to the handler's destination @@ -322,19 +322,6 @@ return ignore.

Default is log.

- depth = pos_integer() | unlimited - -

Specifies if the depth of terms in the log events shall - be limited by using control characters ~P - and ~W instead of ~p and ~w, - respectively. See - io:format.

-
- max_size = pos_integer() | unlimited - -

Specifies if the size of a log event shall be limited by - truncating the formatted string.

-
formatter = {Module::module(),Extra::term()}

See Formatter for more @@ -347,10 +334,9 @@

Note that level and filters are obeyed by Logger itself before forwarding the log events to each - handler, while depth, max_size - and formatter are left to the handler - implementation. All Logger's built-in handlers do apply these - configuration parameters before printing.

+ handler, while formatter is left to the handler + implementation. All Logger's built-in handlers will call the + given formatter before printing.

diff --git a/lib/kernel/src/logger_formatter.erl b/lib/kernel/src/logger_formatter.erl index 5358652692..8e954f8d98 100644 --- a/lib/kernel/src/logger_formatter.erl +++ b/lib/kernel/src/logger_formatter.erl @@ -29,7 +29,7 @@ %%%----------------------------------------------------------------- %%% API --spec format(Log,Config) -> String when +-spec format(Log,Config) -> unicode:chardata() when Log :: logger:log(), Config :: #{single_line=>boolean(), legacy_header=>boolean(), @@ -38,8 +38,7 @@ max_size=>pos_integer() | unlimited, depth=>pos_integer() | unlimited, template=>template(), - utc=>boolean()}, - String :: string(). + utc=>boolean()}. format(#{level:=Level,msg:=Msg0,meta:=Meta},Config0) when is_map(Config0) -> Config = add_default_config(Config0), -- cgit v1.2.3