Options for configuring the logger.

interface LoggerOptions {
    base?: null | { [key: string]: any };
    enabled?: boolean;
    hooks?: {
        logMethod?: (
            this: Logger<never, boolean>,
            args: [msg: string, ...args: any[]],
            method: LogFn,
            level: number,
        ) => void;
    };
    level?: LevelWithSilentOrString;
    mixin?: MixinFn<never>;
    pinoCaller?: boolean;
    prettyPrint?: boolean;
    redact?: string[] | redactOptions;
}

Properties

base?: null | { [key: string]: any }

Base properties to include in log output.

enabled?: boolean

Determines if logging is enabled.

hooks?: {
    logMethod?: (
        this: Logger<never, boolean>,
        args: [msg: string, ...args: any[]],
        method: LogFn,
        level: number,
    ) => void;
}

Hooks for customizing log behavior.

Type declaration

  • OptionallogMethod?: (
        this: Logger<never, boolean>,
        args: [msg: string, ...args: any[]],
        method: LogFn,
        level: number,
    ) => void

    Allows for manipulating the parameters passed to logger methods. The signature for this hook is logMethod (args, method, level) {}, where args is an array of the arguments that were passed to the log method and method is the log method itself, and level is the log level. This hook must invoke the method function by using apply, like so: method.apply(this, newArgumentsArray).

level?: LevelWithSilentOrString

Specifies the logging level.

mixin?: MixinFn<never>

Function to add custom properties to log output.

pinoCaller?: boolean

Includes the caller's file and line number in log output.

prettyPrint?: boolean

Enables pretty-printing of log output.

redact?: string[] | redactOptions

Defines paths to redact from log output.