Provides a customizable logging mechanism across different levels of verbosity.

Hierarchy (view full)

Constructors

Methods

  • Clears the context for a specific task ID.

    Parameters

    • taskId: string

      Unique identifier for the current task/thread

    Returns void

  • Logs a debug message.

    Parameters

    • msg: MessageType

      The debug message to log.

    • OptionaltaskId: string

      Optional task identifier to retrieve the correct context

    Returns void

  • Logs an error message.

    Parameters

    • msg: MessageType

      The error message to log.

    • OptionaltaskId: string

      Optional task identifier to retrieve the correct context

    Returns void

  • Logs an info message.

    Parameters

    • msg: MessageType

      The info message to log.

    • OptionaltaskId: string

      Optional task identifier to retrieve the correct context

    Returns void

  • Logs a message at the specified log level if a corresponding log function is defined.

    Parameters

    • level: LogLevel

      The severity level of the log entry.

    • msg: MessageType

      The content of the log message.

    • OptionaltaskId: string

      Optional task identifier to retrieve the correct context

    Returns void

  • Sets the context for a specific task ID.

    Parameters

    • taskId: string

      Unique identifier for the current task/thread

    • context: string

      The context string to prepend to log messages.

    Returns void

  • Logs a warning message.

    Parameters

    • msg: MessageType

      The warning message to log.

    • OptionaltaskId: string

      Optional task identifier to retrieve the correct context

    Returns void

  • Creates a new execution context and returns a function to run code within it.

    Type Parameters

    • T

    Parameters

    • contextName: string

      The name of the context to use in logs

    Returns ((fn: (() => Promise<T>)) => Promise<T>)

    A function that executes the provided callback in the context

      • (fn): Promise<T>
      • Parameters

        • fn: (() => Promise<T>)
            • (): Promise<T>
            • Returns Promise<T>

        Returns Promise<T>