Each Logger handler has a configured formatter specified as a
module and a configuration term. The purpose of the formatter is
to translate the log events to a final printable string
(
The configuration term for
A positive integer representing the value of the option
with the same name to be used when calling
Defaults to
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
Defaults to
If set to
Defaults to
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
Defaults to
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,
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.
The value must be a function with arity 1,
returning
If set to
Defaults to
The template describes how the formatted string is
composed by combining different data values from the log
event. See the description of
the
Timestamps are formatted according to RFC3339, and the time designator is the character used as date and time separator.
Defaults to
The value of this parameter is used as
the
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
Strings, other than
Integers must be in microseconds, meaning that the
offset
Defaults to an empty string, meaning that timestamps
are displayed in local time. However, for backwards
compatibility, if the SASL configuration
parameter
The value of this parameter is used as
the
The template is a list of atoms, atom lists, tuples and strings. The
atoms
#{key1 => #{key2 => my_value,
...}
...}
Tuples in the template express if-exist tests for metadata
keys. For example, the following tuple says that
if
{key1, ["key1=",key1], []}
Strings in the template are printed literally.
The default value for the
The log event used in the examples is:
?LOG_ERROR("name: ~p~nexit_reason: ~p", [my_name, "It crashed"])
Default
template:
Example log entry:
=ERROR REPORT==== 17-May-2018::18:30:19.453447 ===
name: my_name
exit_reason: "It crashed"
Notice that all eight levels can occur in the heading,
not only
Default
template:
Notice that the template is here the same as
for
=ERROR REPORT==== 17-May-2018::18:31:06.952665 ===
name: my_name, exit_reason: "It crashed"
Default template:
Example log entry:
2018-05-17T18:31:31.152864+02:00 error: name: my_name, exit_reason: "It crashed"
Default template:
Example log entry:
2018-05-17T18:32:20.105422+02:00 error:
name: my_name
exit_reason: "It crashed"
The function is called by Logger when the formatter
configuration for a handler is set or modified. It
returns
The following Logger API functions can trigger this callback:
This the formatter callback function to be called from handlers. The log event is processed as follows: