@willow-dls/core
    Preparing search index...

    Class CircuitLoggerAbstract

    A Circuit Logger is a log sink. Messages are sent to circuit loggers via CircuitLoggable. Loggers are responsible for storing the messages and outputting them to either another logging framework, or sink them into a file or log server. There are no limitations as to what a logger can do with log messages that it receives, however output should complete relatively quickly, as it is not asynchronous to ensure that messages are logged in the order they are intended to be.

    Hierarchy (View Summary)

    Index

    Constructors

    Methods

    • Log a message to this logger. This method should normally not be used by most code, instead it is called by CircuitLoggable.log.

      Parameters

      • level: LogLevel

        The log level at which the message should be logged.

      • subsystem: string

        The subsystem for which the message is being logged.

      • msg: string

        The message to be logged.

      • Optionaldata: any

        Any additional data which should be logged but isn't necessarily fit for being embedded in the message.

      Returns void

    • This abstract function is to be implemented by loggers. It sinks the provided log message to whatever the log output is, be it a database, syslog, file, etc.

      Parameters

      • count: number

        A counter which increments up for each message that is logged. This can be used to ensure that messages are ordered correctly, or displayed in the final output somehow.

      • timestamp: Date

        The exact timestamp at which the log message was generated.

      • level: LogLevel

        The log level that the message is being logged at. Note that this function does not need to check the log level to filter out messages; messages will not be passed to this function in the first place if it shouldn't be logged due to the log level being too high.

      • subsystem: string

        The subsystem from which the log message came.

      • msg: string

        The log message.

      • Optionaldata: any

        Any additional data associated with the message but not explicitly a part of it.

      Returns void

    • Set the log level for this logger. Note that this can be called at any point, and when it is called, it does not do anything with previous messages, but it takes effect immediately when future messages are logged.

      Parameters

      • level: LogLevel

        The log level below which no messages will be output to this logger. All messages at or above this level will be logged.

      Returns CircuitLogger

      The current instance of CircuitLogger, for method chaining.

    • CircuitLoggables are assigned a "subsystem" ID which identifies it uniquely as something that logs messages. These subsystem strings can be used to filter out logs, which is exactly what this function does. It allows you to specify which subsystems you want to be logged and which subsystems you want to ignore.

      Parameters

      • ...subsystems: RegExp[]

        An array of regular expressions which a CircuitLoggable's subsystem ID must match in order for it to be logged. Note that only only one regular expression needs to be matched; as soon as a match is found, the message will be logged if the log level allows it. This allows you to log multiple subsystems without having to specify complex regular expressions; just specify a regular expression for each subsystem you want to match in whatever way makes sense to you.

      Returns CircuitLogger

      The current instanceof CircuitLogger, for method chaining.