pino-pretty options and additional options specific to how @foxxmd/logging uses pino-pretty

interface PrettyOptionsExtra {
    hideObject?: boolean;
    translateTime?: string | boolean;
    levelFirst?: boolean;
    levelKey?: string;
    levelLabel?: string;
    messageKey?: string;
    singleLine?: boolean;
    timestampKey?: string;
    minimumLevel?: Level;
    messageFormat?: string | false | MessageFormatFunc;
    colorize?: boolean;
    colorizeObjects?: boolean;
    crlf?: boolean;
    errorLikeObjectKeys?: string[];
    errorProps?: string;
    ignore?: string;
    include?: string;
    sync?: boolean;
    destination?:
        | string
        | number
        | DestinationStream
        | WritableStream;
    append?: boolean;
    mkdir?: boolean;
    customPrettifiers?: Record<string, Prettifier<object>> & {
        level?: Prettifier<LevelPrettifierExtras>;
    };
    customColors?: string | object;
    useOnlyCustomProps?: boolean;
    redactCwd?: boolean;
    padLevels?: boolean;
}

Hierarchy (view full)

Properties

hideObject?: boolean

Hide objects from output (but not error object).

false
translateTime?: string | boolean

Translate the epoch time value into a human readable date and time string. This flag also can set the format string to apply when translating the date to human readable format. For a list of available pattern letters see the documentation.

  • The default format is yyyy-mm-dd HH:MM:ss.l o in UTC.
  • Requires a SYS: prefix to translate time to the local system's timezone. Use the shortcut SYS:standard to translate time to yyyy-mm-dd HH:MM:ss.l o in system timezone.
false
levelFirst?: boolean

If set to true, it will print the name of the log level as the first field in the log line.

false
levelKey?: string

Define the key that contains the level of the log.

"level"
levelLabel?: string

Output the log level using the specified label.

"levelLabel"
messageKey?: string

The key in the JSON object to use as the highlighted message.

"msg"

Not required when used with pino >= 8.21.0
singleLine?: boolean

Print each log message on a single line (errors will still be multi-line).

false
timestampKey?: string

The key in the JSON object to use for timestamp display.

"time"
minimumLevel?: Level

The minimum log level to include in the output.

"trace"
messageFormat?: string | false | MessageFormatFunc

Format output of message, e.g. {level} - {pid} will output message: INFO - 1123

false
{
messageFormat: (log, messageKey) => {
const message = log[messageKey];
if (log.requestId) return `[${log.requestId}] ${message}`;
return message;
}
}
colorize?: boolean

If set to true, will add color information to the formatted output message.

false
colorizeObjects?: boolean

If set to false while colorize is true, will output JSON objects without color.

true
crlf?: boolean

Appends carriage return and line feed, instead of just a line feed, to the formatted log line.

false
errorLikeObjectKeys?: string[]

Define the log keys that are associated with error like objects.

["err", "error"]

Not required to handle custom errorKey when used with pino >= 8.21.0
errorProps?: string

When formatting an error object, display this list of properties. The list should be a comma separated list of properties.

""
ignore?: string

Ignore one or several keys. Will be overridden by the option include if include is presented.

"time,hostname"
include?: string

Include one or several keys.

"time,level"
sync?: boolean

Makes messaging synchronous.

false
destination?:
    | string
    | number
    | DestinationStream
    | WritableStream

The file, file descriptor, or stream to write to. Defaults to 1 (stdout).

1
append?: boolean

Opens the file with the 'a' flag.

true
mkdir?: boolean

Ensure directory for destination file exists.

false
customPrettifiers?: Record<string, Prettifier<object>> & {
    level?: Prettifier<LevelPrettifierExtras>;
}

Provides the ability to add a custom prettify function for specific log properties. customPrettifiers is an object, where keys are log properties that will be prettified and value is the prettify function itself. For example, if a log line contains a query property, you can specify a prettifier for it:

{}
{
customPrettifiers: {
query: prettifyQuery
}
}
//...
const prettifyQuery = value => {
// do some prettify magic
}
customColors?: string | object

Change the level colors to an user custom preset.

Can be a CSV string in 'level_name:color_value' format or an object. Also supports 'default' as level_name for fallback color.

( CSV ) customColors: 'info:white,some_level:red'
( Object ) customColors: { info: 'white', some_level: 'red' }
useOnlyCustomProps?: boolean

Only use custom levels and colors (if provided); else fallback to default levels and colors.

true
redactCwd?: boolean

Control whether the current working directory should be replaced with 'CWD' in log output

Useful for eliminating noisy parent paths that aren't relevant during debugging -- or to protect user privacy.

NOTE: Only applies to log message and errors. If you need to redact arbitrary properties you should use pino's redact or pino-pretty's customPrettifiers

true
padLevels?: boolean

Pads levels in log string so all are the same length

true