Skip to content

Customisation

Logger options

Defaults

See defaults.ts

Types:

interface Partial<LoggerOptions> {
    levels?: {
        [name: string]: string
    },
    namespaces?: Array<string>,
    transports?: Array<Transport>
}

levels

Default
levels: {
    debug: 'info',
    verbose: 'info',
    info: 'info',
    success: 'info',
    warn: 'warn',
    notice: 'warn',
    error: 'error',
    critical: 'error'
}

You shouldn't need to change these. If you do, you're probably using levels incorrectly and you should look at namespaces.

namespaces

Default
namespaces: []

Use namespaces to separate your logs into to logical areas (eg. log.info.exampleNamespace())

transports

Default
transports: [
    new ConsoleTransport(),
    new FileTransport()
]

Transports are where the heavy lifting is done. When you use a log function, a log object is passed to the write function of each transport with a matching log level.


Last update: February 24, 2023