Skip to main content

Import

Constructor

Config options

Log levels

Levels are ordered by severity. Setting a level silences everything below it.

Methods

Transport interface

Any object that implements the following method can be used as a transport:

createLogger factory

Shortcut that creates and returns a Logger instance. Accepts the same config as the constructor.

Examples

Basic usage

Child loggers

Create scoped loggers that inherit the parent’s config and prepend a namespace.

Custom transport

Runtime level switching

Silent mode for tests

Use child() to give each module its own namespace. This makes it easy to filter logs in production without changing log levels globally.
The default transport writes to console. Add custom transports to send logs to files, remote services, or monitoring tools.