Class FormattedAppenderAbstract

A formatted appender creates a single lined string the structure of which can be specified by a pattern.

Version

1

Hierarchy (view full)

Constructors

Properties

_buffer: LogMessage[]

A buffer that will be filled with log messages until the Appender is writable.

_filterRelation: FilterRelation

The relation, to which all the appenders results must adhere. See FilterRelation.

_filters: Filter[]

The filter that will be evaluated in order to determine whether a message shall be handled by this appender.

ageLookup: string[] = DefaultFormats.ENUMS.AGE
dayOfTheWeekLookup: string[] = DefaultFormats.ENUMS.DAY_OF_WEEK
format: string

The log message format to use. All properties of a log message can be inserted to their placeholders, e.g. '%id%'.

monthLookup: string[] = DefaultFormats.ENUMS.MONTH
noonLookup: string[] = DefaultFormats.ENUMS.NOON
separatorLookup: string[] = DefaultFormats.ENUMS.SEPARATOR
severityLookup: string[] = DefaultFormats.ENUMS.SEVERITY

A simple lookup from where the strings for the severity levels can be fetched. see DefaultFormats.ENUMS.SEVERITY

timeFormat: string

The time format to use for the %time% placeholder. The time format is inspired by https://msdn.microsoft.com/de-de/library/8kb3ddd4(v=vs.110).aspx, but some of the placeholders might not work.

Accessors

Methods

  • This function does the actual appending, e.g. to the console or a file, and thus, must be overriden by subclasses. The default implementation does nothing.

    Parameters

    Returns void

  • Removes all ansi style sequences from the string.

    Parameters

    • str: string

      The string to clean from the ansi sequences.

    Returns string

  • Clears the temporary message cache. If the appender is writable, the messages in the cache will be forwarded to the _handleMessage method.

    Returns void

  • Evaluates the message with respect to the message filters set.

    Parameters

    Returns boolean

    True, if the message matches the filters, false otherwise.

  • Returns true, if the appender is able to receive messages.

    Returns boolean

    True, if the appender is currently writable, false otherwise

  • Processes the log message parameters in order to replace the placeholders in the message string.

    Parameters

    Returns null | string

    The processed message string with inserted message parameters.

  • The input function of an Appender for any log message. This function calls the filter evaluation, and hands the message over to the _handleMessage method, if the appender is currently writable. If the appender is not writable, the message is stored to the internal buffer.

    Parameters

    • msg: LogMessage

      The message that shall be received and appended.

    Returns boolean

    True, if the message was handled, false otherwise.