Module util_log_formatter

Derived from //kernel/logger/logger_formatter.

Description

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

Data Types

config()

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()}

metakey()

metakey() = atom() | [atom()]

template()

template() = 
    [metakey() | {metakey(), template(), template()} | string()]

Function Index

check_config/1
format/2

Function Details

check_config/1

check_config(Config) -> ok | {error, term()}

format/2

format(LogEvent, Config) -> unicode:chardata()