Class LoggerTransport

Core mechanism that allows many Logger instances to report back to a shared resource.

Primary entrypoints:

  • events() - the shared EventEmitter of this tranport
  • setFilter(...) - determines which events get emitted
  • setDefaultBroadcastEnabled(...) - toggles global console variable usage

NOTE: Call disableEventCaching() to revert to v5.x non-event-caching behavior.

Hierarchy

Constructors

Properties

buffer: LogEventBuffer = ...

Data source responsible for producing new events, or recycling previously created ones.

guard: LogEventGuard = ...

Methods

  • Default creator function used by the Logger class.

    Parameters

    • level: number
    • context: string
    • message: string
    • Optional params: any[]
    • Optional timestamp: number

    Returns LogEvent

  • If the transport can accept the given event, sends the event to all listeners in the events() EventEmitter instance. If the event is not accepted, this does nothing.

    Parameters

    Returns void

  • Set the enabled state of this instance, regarding whether or not it will emit any log events. When true, emits events as normal; when false, suppresses all events.

    The main benefit of this is to temorarily suppress all events on this instance, while keeping the currently set filter in-tact.

    e.g. If this instance has a custom filter set, and then is disabled, when this is re-enabled later it will continue using the custom filter.

    Parameters

    • enabled: boolean

    Returns LoggerTransport

Generated using TypeDoc