Options
All
  • Public
  • Public/Protected
  • All
Menu

Defines a LogGroupRule, this allows you to either have everything configured the same way or for example loggers that start with name model. It allows you to group loggers together to have a certain loglevel and other settings. You can configure this when creating the LoggerFactory (which accepts multiple LogGroupRules).

Hierarchy

  • LogGroupRule

Index

Constructors

constructor

  • Create a LogGroupRule. Basically you define what logger name(s) match for this group, what level should be used what logger type (where to log) and what format to write in. If the loggerType is custom, then the callBackLogger must be supplied as callback function to return a custom logger.

    Parameters

    • regExp: RegExp

      Regular expression, what matches for your logger names for this group

    • level: LogLevel

      LogLevel

    • Default value logFormat: LogFormat = new LogFormat()

      LogFormat

    • Default value loggerType: LoggerType = LoggerType.Console

      Type of logger, if Custom, make sure to implement callBackLogger and pass in, this will be called so you can return your own logger.

    • Default value callBackLogger: function | null = null

      Callback function to return a new clean custom logger (yours!)

    Returns LogGroupRule

Accessors

callBackLogger

  • get callBackLogger(): function | null

formatterLogMessage

  • get formatterLogMessage(): function | null
  • set formatterLogMessage(value: function | null): void
  • Get the formatterLogMessage function, see comment on the setter.

    Returns function | null

  • Set the default formatterLogMessage function, if set it is applied to all type of loggers except for a custom logger. By default this is null (not set). You can assign a function to allow custom formatting of a log message. Each log message will call this function then and expects your function to format the message and return a string. Will throw an error if you attempt to set a formatterLogMessage if the LoggerType is custom.

    Parameters

    • value: function | null

      The formatter function, or null to reset it.

    Returns void

level

logFormat

loggerType

regExp

  • get regExp(): RegExp

Generated using TypeDoc