Pipit - v2.0.1
    Preparing search index...

    Class Logger<Args, Context>

    Dispatches logged messages to channels.

    Type Parameters

    • Args extends readonly any[] = any[]

      Arguments of logging methods of the Logger.

    • Context extends object | undefined = Record<string, unknown> | undefined

      The context that is added to logged messages.

    Index

    Constructors

    • Creates the new Logger instance.

      Type Parameters

      • Args extends readonly any[] = any[]

        Arguments of logging methods of the Logger.

      • Context extends object | undefined = Record<string, unknown> | undefined

        The context that is added to logged messages.

      Parameters

      • Optionallevel: number

        The minimum log level of messages that would be dispatched to channels.

      Returns Logger<Args, Context>

    • Creates the new Logger instance.

      Type Parameters

      • Args extends readonly any[] = any[]

        Arguments of logging methods of the Logger.

      • Context extends object | undefined = Record<string, unknown> | undefined

        The context that is added to logged messages.

      Parameters

      • level: number

        The minimum log level of messages that would be dispatched to channels.

      • context: Context

        The context that is added to dispatched messages.

      Returns Logger<Args, Context>

    Properties

    _channels: ((messages: LogMessage[]) => void)[] = []

    The list of channels.

    _pubSub: PubSub<LoggerEvent> = ...

    The logger event bus.

    context: Context

    The context that is added to logged messages.

    level: number

    The minimum log level of messages that would be dispatched to channels.

    log: (...args: Args) => void = ...

    Log an informational message that highlight the progress of the application at coarse-grained level.

    The alias for info.

    Type Declaration

      • (...args: Args): void
      • Log an informational message that highlight the progress of the application at coarse-grained level.

        Parameters

        Returns void

    Accessors

    • get isDebugEnabled(): boolean

      true if debug messages are logged.

      Returns boolean

    • get isErrorEnabled(): boolean

      true if error messages are logged.

      Returns boolean

    • get isFatalEnabled(): boolean

      true if fatal messages are logged.

      Returns boolean

    • get isInfoEnabled(): boolean

      true if info messages are logged.

      Returns boolean

    • get isTraceEnabled(): boolean

      true if trace messages are logged.

      Returns boolean

    • get isWarnEnabled(): boolean

      true if warn messages are logged.

      Returns boolean

    Methods

    • Dispatches message to channels.

      Parameters

      • level: number

        The message level.

      • args: readonly any[]

        The message arguments.

      • context: any

        The message context.

      Returns void

    • Creates a new channel and appends it to this logger.

      Parameters

      • ...processors: LogProcessor[]

        Processors that are added to a channel.

      Returns this

    • Log a fine-grained informational message that are most useful to debug an application.

      Parameters

      Returns void

    • Log an error event that might still allow the application to continue running.

      Parameters

      Returns void

    • Log a very severe error events that will presumably lead the application to abort.

      Parameters

      Returns void

    • Notifies processors that all messages that are not yet dispatched, should be dispatched immediatelly.

      Returns void

    • Log an informational message that highlight the progress of the application at coarse-grained level.

      Parameters

      Returns void

    • Publishes an event to subscribers of this logger.

      Parameters

      Returns void

    • Removes all channels, unsubscribes all subscribers, and resets the log level.

      Parameters

      • level: number = ...

        The minimum log level of messages that would be dispatched to channels.

      • context: Context = ...

        The context that is added to dispatched messages.

      Returns this

    • Subscribes to events published by the logger.

      Parameters

      • listener: (event: LoggerEvent) => void

        The listener callback that is invoked when an event is published.

      Returns () => void

      The callback that unsubscribes the listener.

    • Log a finer-grained informational message than the debug, usually with a stack trace.

      Parameters

      Returns void

    • Log a potentially harmful situation.

      Parameters

      Returns void