Skip to content
This repository has been archived by the owner on Jul 30, 2021. It is now read-only.
Danil Andreev edited this page Feb 2, 2021 · 6 revisions

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

  • verbosity?: 1 | 2 | 3 | 4
    Verbosity level of the message. Used to filter log messages.
  • disableDB?: boolean = false
    If true, database sync is disabled. Message will not be stored in database.

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");