Logger - AtlasRender/atlas-core Wiki

Logger

/core/Logger

Logging system.

Overview

Logger system designed for application feedback. You can use it for logging info about app runtime problems or debug info. It automatically saves log messages into database.

Database stored messages

By default all messages will be stored into database for cluster debug. But if it is not necessary to store log message you can turn off database sync for selected messages.

Message verbosity

Each message has verbosity parameter which describes the importance of the message. Log viewer can switch verbosity level. If log viewer select verbosity level that higher than message verbosity level - message will be shown.

Options

Methods

Logger.info

Specification

Logger.info(options?: Logger.Options)(...payload: any[]);

Description

Prints log message to stdout and saves it to database.

Example

Logger.info({verbosity: 1})("Hello", "Darkness", "My", "Old", "Friend");

Logger.info({verbosity: 1, disableDB: true})("Database saving is disabled");

Logger.warn

Specification

Logger.warn(options?: Logger.Options)(...payload: any[]);

Description

Prints warning message to stdout and saves it to database.

Example

Logger.warn({verbosity: 1})("This is a warning!");

Logger.warn({verbosity: 1, disableDB: true})("Database saving is disabled");

Logger.error

Specification

Logger.error(options?: Logger.Options)(...payload: any[]);

Description

Prints error message to stdout and saves it to database.

Example

Logger.error({verbosity: 1})("Error", new TypeError("Incorrect type!"));

Logger.error({verbosity: 1, disableDB: true})("Database saving is disabled");