Skip to main content

Logger

pino-based logging system.


logger

pino logger instance.

protected logger: PinoLogger;

destination

Custom pino destination for logs (e.g. specific file, distant stream, ...).

protected destination?: PinoDestination;

level

Minimum logging level (all logs below that level won't be logs).

public readonly level: 'debug' | 'info' | 'warn' | 'error' | 'fatal';

constructor

Class constructor.

public constructor(settings: LoggerSettings);

Parameters

  • settings: Logger settings.

Usage

TODO

child

Only for pino compatibility.

public child(): PinoLogger;

Parameters

  • settings: Logger settings.

Usage

TODO

silent

Only for pino compatibility.

public silent(message: unknown, ...args: unknown[]): void;

Parameters

  • settings: Logger settings.

Usage

TODO

trace

@deprecated Use debug instead.

public trace(message: unknown, ...args: unknown[]): void;

Parameters

  • settings: Logger settings.

Usage

TODO

debug

Information that is diagnostically helpful to people more than just developers (IT, sysadmins, etc.). This should be the minimum logging level in development.

public debug(message: unknown, ...args: unknown[]): void;

Parameters

  • settings: Logger settings.

Usage

TODO

info

Generally useful information to log (service start/stop, configuration assumptions, etc). Info we want to always have available but usually don't care about under normal circumstances. This should be the minimum logging level in (pre)production.

public info(message: unknown, ...args: unknown[]): void;

Parameters

  • settings: Logger settings.

Usage

TODO

warn

Anything that can potentially cause application oddities, but which is not a serious concern (Such as switching from a primary to backup server, retrying an operation, missing secondary data, etc.). Not much to worry about, but it is still important to analyze warnings on a regular basis to identify potential issues.

public warn(message: unknown, ...args: unknown[]): void;

Parameters

  • settings: Logger settings.

Usage

TODO

error

Any error which is fatal to the operation, but not the service or application (can't open a required file, missing data, etc.). These errors will force user (administrator, or direct user) intervention. These are usually reserved for incorrect connection strings, missing services, uncaught exceptions, etc. Constitutes a degradation of service, which means engineering team must be immediately notified.

public error(message: unknown, ...args: unknown[]): void;

Parameters

  • settings: Logger settings.

Usage

TODO

fatal

Any error that is forcing a shutdown of the service or application to prevent data loss (or further data loss). Reserved only for the most heinous errors and situations where there is guaranteed to have been data corruption or loss. Constitutes an interruption of service, which means engineering and SysAdmin / DevOps teams must be immediatly notified.

public fatal(message: unknown, ...args: unknown[]): void;

Parameters

  • settings: Logger settings.

Usage

TODO

waitForReady

Resolves as soon as the logging system is ready to accept logs.

public waitForReady(): Promise<void>;

Parameters

  • settings: Logger settings.

Usage

TODO

close

Gracefully closes pino logger, flushing remaining buffered logs.

public close(): Promise<void>;

Parameters

  • settings: Logger settings.

Usage

TODO