View Source util_log_formatter (util v1.1.5)

Log formatter Derived from //kernel/logger/logger_formatter

This implementation is copied from logger_fomatter.erl and adds the following features:
time_offset = none
when provided, no time zone offset will be written to the log.
time_unit = second | millisecond | microsecond
controls time stamp granularity in the log.
report_prefix = string()
inserts given prefix before msg for logging a report (default: "\n").
report_term_depth = integer()
max depth of terms included in the reports. Use infinity for unlimited (default: 50)

Report printing is modified to align keys in a report to the right.

Additional template formatting atoms:
lev
prints "[X]" to the log to indicate the log level, where X` is the first capitalized letter of the log level.</dd> <dt>LEVEL</dt><dd>same aslevel' but is printed in upper case.
modline
prints 'Module:Line' to the log.
regpid
prints:
*
if the registered name of the caller's pid matches caller's module name.
RegisteredName
of the calling process
X.Y.Z
pid of the caller with leading 0. stripped.
regname
prints <RegisteredName> of the process or its pid if the process is not registered

Link to this section Summary

Link to this section Types

-type config() ::
    #{chars_limit => pos_integer() | unlimited,
      depth => pos_integer() | unlimited,
      legacy_header => boolean(),
      max_size => pos_integer() | unlimited,
      report_cb => logger:report_cb(),
      single_line => boolean(),
      template => template(),
      time_designator => byte(),
      time_offset => integer() | [byte()] | none,
      time_unit => atom(),
      report_prefix => boolean(),
      report_term_depth => integer()}.
-type metakey() :: atom() | [atom()].
-type template() :: [metakey() | {metakey(), template(), template()} | string()].

Link to this section Functions

-spec check_config(Config) -> ok | {error, term()} when Config :: config().
Link to this function

format(LogEvent, Config)

View Source
-spec format(LogEvent, Config) -> unicode:chardata()
          when LogEvent :: logger:log_event(), Config :: config().