config() =
#{chars_limit => integer() >= 1 | unlimited,
depth => integer() >= 1 | unlimited,
legacy_header => boolean(),
max_size => integer() >= 1 | unlimited,
report_cb => logger:report_cb(),
single_line => boolean(),
template => template(),
time_designator => byte(),
time_offset => integer() | [byte()]}
config() =
#{chars_limit => integer() >= 1 | unlimited,
depth => integer() >= 1 | unlimited,
legacy_header => boolean(),
max_size => integer() >= 1 | unlimited,
report_cb => logger:report_cb(),
single_line => boolean(),
template => template(),
time_designator => byte(),
time_offset => integer() | [byte()]}
The configuration term for logger_formatter
is a map
, and the following keys can be set as configuration parameters:
-
chars_limit = integer() > 0 | unlimited
-
A positive integer representing the value of the option with the same name to be used when calling
io_lib:format/3
. This value limits the total number of characters printed for each log event. Notice that this is a soft limit. For a hard truncation limit, see optionmax_size
.Defaults to
unlimited
. -
depth = integer() > 0 | unlimited
-
A positive integer representing the maximum depth to which terms shall be printed by this formatter. Format strings passed to this formatter are rewritten. The format controls ~p and ~w are replaced with ~P and ~W, respectively, and the value is used as the depth parameter. For details, see
io:format/2,3
in STDLIB.Defaults to
unlimited
. -
legacy_header = boolean()
-
If set to
true
a header field is added to logger_formatter's part ofMetadata
. The value of this field is a string similar to the header created by the olderror_logger
event handlers. It can be included in the log event by adding the list[logger_formatter,header]
to the template. See the description of thetemplate()
type for more information.Defaults to
false
. -
max_size = integer() > 0 | unlimited
-
A positive integer representing the absolute maximum size a string returned from this formatter can have. If the formatted string is longer, after possibly being limited by
chars_limit
ordepth
, it is truncated.Defaults to
unlimited
. -
report_cb =
logger:report_cb()
-
A report callback is used by the formatter to transform log messages on report form to a format string and arguments. The report callback can be specified in the metadata for the log event. If no report callback exists in metadata,
logger_formatter
will uselogger:format_report/1
as default callback.If this configuration parameter is set, it replaces both the default report callback, and any report callback found in metadata. That is, all reports are converted by this configured function.
-
single_line = boolean()
-
If set to
true
, each log event is printed as a single line. To achieve this,logger_formatter
sets the field width to0
for all~p
and~P
control sequences in the format a string (seeio:format/2
), and replaces all newlines in the message with", "
. White spaces following directly after newlines are removed. Notice that newlines added by thetemplate
parameter are not replaced.Defaults to
true
. -
template =
template()
-
The template describes how the formatted string is composed by combining different data values from the log event. See the description of the
template()
type for more information about this. -
time_designator = byte()
-
Timestamps are formatted according to RFC3339, and the time designator is the character used as date and time separator.
Defaults to
$T
.The value of this parameter is used as the
time_designator
option tocalendar:system_time_to_rcf3339/2
. -
time_offset = integer() | [byte()]
-
The time offset, either a string or an integer, to be used when formatting the timestamp.
An empty string is interpreted as local time. The values
"Z"
,"z"
or0
are interpreted as Universal Coordinated Time (UTC).Strings, other than
"Z"
,"z"
, or""
, must be on the form±[hh]:[mm]
, for example"-02:00"
or"+00:00"
.Integers must be in microseconds, meaning that the offset
7200000000
is equivalent to"+02:00"
.Defaults to an empty string, meaning that timestamps are displayed in local time. However, for backwards compatibility, if the SASL configuration parameter
utc_log
=true
, the default is changed to"Z"
, meaning that timestamps are displayed in UTC.The value of this parameter is used as the
offset
option tocalendar:system_time_to_rcf3339/2
.