Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface ILogger

Hierarchy

  • ILogger

Implemented by

Index

Properties

Readonly context

context: string

Current context this logger is scoped to.

Readonly metadata

metadata: Record<string, unknown>

Current metadata stored on this logger.

Methods

addHandler

  • Attaches an ILogHandler to this instance. All created ILogRecords will be passed to the given handler.

    Parameters

    • handler: ILogHandler

      Handler that receives created ILogRecords

    • Optional condition: boolean | (() => boolean)

      Optional condition for adding the handler. Allows handlers to be added conditionally while using a fluent api.

    Returns ILogger

addMetadata

  • addMetadata(metadata: Record<string, unknown>): ILogger
  • Adds a metadata object to the logger which will be included in created ILogRecords. New metadata will be merged with existing metadata. Existing keys will be overwritten.

    Parameters

    • metadata: Record<string, unknown>

      Metadata to add to the logger

    Returns ILogger

critical

  • critical(...args: unknown[]): void
  • Sends a log record with the level CRITICAL to all handlers.

    Parameters

    • Rest ...args: unknown[]

    Returns void

debug

  • debug(...args: unknown[]): void
  • Sends a log record with the level DEBUG to all handlers.

    Parameters

    • Rest ...args: unknown[]

    Returns void

error

  • error(...args: unknown[]): void
  • Sends a log record with the level ERROR to all handlers.

    Parameters

    • Rest ...args: unknown[]

    Returns void

info

  • info(...args: unknown[]): void
  • Sends a log record with the level INFO to all handlers.

    Parameters

    • Rest ...args: unknown[]

    Returns void

verbose

  • verbose(...args: unknown[]): void
  • Sends a log record with the level VERBOSE to all handlers.

    Parameters

    • Rest ...args: unknown[]

    Returns void

warning

  • warning(...args: unknown[]): void
  • Sends a log record with the level WARNING to all handlers.

    Parameters

    • Rest ...args: unknown[]

    Returns void

withContext

  • withContext(context: string): ILogger
  • Creates a new logger scoped to a given context. All current handlers and metadata is copied over to the logger.

    Parameters

    • context: string

      New scope for the logger.

    Returns ILogger

Generated using TypeDoc