Class SimpleTextDestination

A minimalistic text based destination that output using following format:

  • <timestamp in ISO>|<1st char of severity> <message> [<Error name>:<Error message>] [{"key": "value", ...}]

E.g.:

  • 2022-11-02T19:51:55.436Z|I This is a info message
  • 2022-11-02T19:51:55.438Z|E Create company failed [BadRequest:Missing vat number] {"name":"ACME Inc"}

Hierarchy

Constructors

Properties

_logInterceptor: undefined | ((entry: IJLogEntry, loggerLevel?: LogLevel, defaultPayload?: IJson) => void) = undefined
_logNameFilter: undefined | string[]
level?: LogLevel

Accessors

  • get filters(): undefined | string[]
  • Returns undefined | string[]

Methods

  • This method must be called by the subclass to write the log entry. It cannot be automated as the basic design of the log destination is to allow the subclass' .write method to return different type of value depending on the implementation.

    Parameters

    Returns void

  • Add this destination to LoggerFactory. Usage:

    Use default or configured setting from logger.json

    • SimpleJsonDestination.use());

    Set both level and logger name filter

    • SimpleJsonDestination.use(LogLevel.INFO, 'my-logger');

    Set only logger name filter

    • SimpleJsonDestination.use('my-logger', 'another-logger');

    Returns

    Parameters

    • Optional level: string | LogLevel
    • Rest ...filters: string[]

    Returns SimpleTextDestination

Generated using TypeDoc