The various options for the built-in text formatters.
timestamp:
The timestamp format. This can be one of the following:
"date-time-timezone"
: The date and time with the full timezone offset (e.g.,"2023-11-14 22:13:20.000 +00:00"
)."date-time-tz"
: The date and time with the short timezone offset (e.g.,"2023-11-14 22:13:20.000 +00"
)."date-time"
: The date and time without the timezone offset (e.g.,"2023-11-14 22:13:20.000"
)."time-timezone"
: The time with the full timezone offset but without the date (e.g.,"22:13:20.000 +00:00"
)."time-tz"
: The time with the short timezone offset but without the date (e.g.,"22:13:20.000 +00"
)."time"
: The time without the date or timezone offset (e.g.,"22:13:20.000"
)."date"
: The date without the time or timezone offset (e.g.,"2023-11-14"
)."rfc3339"
: The date and time in RFC 3339 format (e.g.,"2023-11-14T22:13:20.000Z"
).
Alternatively, this can be a function that accepts a timestamp and returns a string.
The default is "date-time-timezone"
.
The log level format. This can be one of the following:
"ABBR"
: The log level abbreviation in uppercase (e.g.,"INF"
)."FULL"
: The full log level name in uppercase (e.g.,"INFO"
)."L"
: The first letter of the log level in uppercase (e.g.,"I"
)."abbr"
: The log level abbreviation in lowercase (e.g.,"inf"
)."full"
: The full log level name in lowercase (e.g.,"info"
)."l"
: The first letter of the log level in lowercase (e.g.,"i"
).
Alternatively, this can be a function that accepts a log level and returns a string.
The default is "ABBR"
.
The separator between category names. For example, if the separator is
"·"
, the category ["a", "b", "c"]
will be formatted as "a·b·c"
.
The default separator is "·"
.
If this is a function, it will be called with the category array and should return a string, which will be used for rendering the category.
The format of the embedded values.
A function that renders a value to a string. This function is used to
render the values in the log record. The default is util.inspect()
in
Node.js/Bun and Deno.inspect()
in Deno.
format: (values: FormattedValues) => string
How those formatted parts are concatenated.
A function that formats the log record. This function is called with the formatted values and should return a string. Note that the formatted should not include a newline character at the end.
By default, this is a function that formats the log record as follows:
2023-11-14 22:13:20.000 +00:00 [INF] category·subcategory: Hello, world!