StandardStreamsLogRecorder
open class StandardStreamsLogRecorder: LogRecorderBase
The StandardStreamsLogRecorder is a LogRecorder that writes log messages
to either the standard output stream (`stdout`
) or the standard error stream
(`stderr`
) of the running process.
Messages are directed to the appropriate stream depending on the severity
property of the LogEntry being recorded.
Messages having a severity of .verbose, .debug and .info will be
directed to stdout, while those with a severity of .warning and .error
are directed to stderr.
-
Initializes a
StandardStreamsLogRecorderinstance to use the specifiedLogFormatters for formatting log messages.Declaration
Swift
public override init(formatters: [LogFormatter], queue: DispatchQueue? = nil)Parameters
formattersAn array of
LogFormatters to use for formatting log entries that will be recorded by the receiver.queueThe
DispatchQueueto use for the recorder. Ifnil, a new queue will be created. -
This implementation, which does nothing, is present to satisfy the
LogRecorderprotocol. Subclasses must override this function to provide actual log recording functionality.Note
This function is only called if one of the
formattersassociated with the receiver returned a non-nilstring for the givenLogEntry.Declaration
Swift
open override func record(message: String, for entry: LogEntry, currentQueue: DispatchQueue, synchronousMode: Bool)Parameters
messageThe message to record.
entryThe
LogEntryfor whichmessagewas created.currentQueueThe GCD queue on which the function is being executed.
synchronousModeIf
true, the recording is being done in synchronous mode, and the recorder should act accordingly.
View on GitHub
StandardStreamsLogRecorder Class Reference