Options
All
  • Public
  • Public/Protected
  • All
Menu

Class FormattingManager

Class responsible for formatters managing.
It is required that formatting is configured before getting a logger instance.

Hierarchy

  • FormattingManager

Constructors

constructor

Methods

formatterFor

  • formatterFor(module: string): Format

removeFormatter

  • removeFormatter(name: string): void
  • Removes existing formatter from known formatters list.
    Formatting order is discarded, reconfiguration is needed later.

    Parameters

    • name: string

      Formatter name.

    Returns void

setClusterNodeId

  • setClusterNodeId(id: string | number): void
  • Set id of the node from cluster.
    This id will be included in each logged message.

    WARNING! This is supported only for OutputFormat.PRINTF.

    Parameters

    • id: string | number

      Cluster node id.

    Returns void

setCustomFormattingOrder

  • setCustomFormattingOrder(order: string[]): void
  • Specifies a custom formatting order which instructs in which order formatters needs to be combined.

    Parameters

    • order: string[]

      List of formatter names.

    Returns void

setDefaultFormattingOrder

  • setDefaultFormattingOrder(outputFormat: OutputFormat, options?: DefaultFormattingOrderOptions): void
  • Configures a formatting order from a predefined set of formatters.
    If a order exists, it will be rewritten.

    Parameters

    • outputFormat: OutputFormat

      Logs output format for which order needs to be constructed.

    • options: DefaultFormattingOrderOptions = {}

      Default formatting options.

    Returns void

setFormatter

  • setFormatter(name: string, formatter: Format): void
  • Set a formatter into known formatters list.
    If formatter exists already, it will be overwritten.
    Formatting order is discarded and needs to be reconfigured.

    Parameters

    • name: string

      Name of the formatter.

    • formatter: Format

      Formatter instance, must be winston compliant.

    Returns void