Construct a new file logger, outputting to the given file or stream.
The file path or a write stream to write log output to. Note that the file will be overwritten if it exists, not appended to.
Attach this logger to a loggable object, so that messages logged in that object will be received by the logger. This function simply calls CircuitLoggable.attachLogger.
The loggable object to attach this logger to.
This logger, for method chaining.
Close the log file, making sure all writes get flushed to the disk.
A promise that is fulfilled when all writes are complete.
Remove this logger from a loggable object, so that messages logged in that object will no longer be received by this logger. This function simply calls CircuitLoggable.detachLogger.
The loggable object to detach this logger from.
This logger, for method chaining.
Log a message to this logger. This method should normally not be used by most code, instead it is called by CircuitLoggable.log.
The log level at which the message should be logged.
The subsystem for which the message is being logged.
The message to be logged.
Optional
data: anyAny additional data which should be logged but isn't necessarily fit for being embedded in the message.
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.
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.
The exact timestamp at which the log message was generated.
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.
The subsystem from which the log message came.
The log message.
Optional
data: anyAny additional data associated with the message but not explicitly a part of it.
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.
The log level below which no messages will be output to this logger. All messages at or above this level will be logged.
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.
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.
The current instanceof CircuitLogger, for method chaining.
A logger implementation that outputs a human-readable log file using the NodeJS stream API. This implementation is useful for writing out circuit executions to a file so that they can be debugged offline after the execution, as it is fairly normal for large circuits to produce large amount of log output.
This logger requires a file name or write stream, and should be closed properly with close when circuit execution is complete.