The root logger module configuration.

interface LoggerRootModuleConfig {
    baseLabels?: Record<string | symbol, string>;
    hideLabels?: (string | symbol)[];
    hideSystemLabels?: boolean;
    level?: string;
    loggingPreset?: "simple" | "pretty" | "json" | "none";
    makeChildLogger?: ((rootLogger, module, conf) => winston.Logger);
    makeLogger?: ((conf) => winston.Logger);
    makeWinstonConfig?: ((conf) => LoggerOptions);
    scope?: string;
    winston?: LoggerOptions;
}

Properties

baseLabels?: Record<string | symbol, string>

The base labels for the logger. These are added to every log message of all child loggers.

hideLabels?: (string | symbol)[]

The labels to hide from the log payload in simple and pretty presets.

hideSystemLabels?: boolean

Hide the system labels from the log payload in simple and pretty presets. (Because it's appearing in log messages)

Default

[LEVEL, SPLAT, 'timestamp', 'module', 'message', 'level', 'hostname']
level?: string

The log level. This is used to filter log messages.

Default

process.env.LOG_LEVEL || 'warning'
loggingPreset?: "simple" | "pretty" | "json" | "none"

The logging preset. This is a shorthand for configuring the logger. Use 'none' to disable presets and use makeWinstonConfig to manually configure the logger.

Default

process.env.LOG_FORMAT || 'simple'
makeChildLogger?: ((rootLogger, module, conf) => winston.Logger)

The child logger factory. This is used to create the child logger.

Type declaration

makeLogger?: ((conf) => winston.Logger)

The logger factory. This is used to create the logger.

Type declaration

makeWinstonConfig?: ((conf) => LoggerOptions)

The logger configuration. This is used to create the logger's configuration.

Type declaration

scope?: string

The scope of the logger. You can have multiple loggers with different scopes.

Default

'default'
winston?: LoggerOptions

The winston configuration. Used to manually configure edge cases.