util_log_formatter (util v1.3.5)
View SourceLog 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 beforemsgfor logging a report (default: "\n").report_term_depth = integer()— max depth of terms included in the reports. Useinfinityfor 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, whereXis the first capitalized letter of the log level.LEVEL— same as 'level' 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 if it is registered under a different name.- the pid of the process if it is not registered.
Summary
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()}.
Functions
-spec format(LogEvent, Config) -> unicode:chardata() when LogEvent :: logger:log_event(), Config :: config().