LogRecorderBase

open class LogRecorderBase: LogRecorder

A partial implementation of the LogRecorder protocol.

  • The LogFormatters that will be used to format messages for the LogEntrys to be logged.

    Declaration

    Swift

    open let formatters: [LogFormatter]
  • The GCD queue that should be used for logging actions related to the receiver.

    Declaration

    Swift

    open let queue: DispatchQueue
  • Initialize a new LogRecorderBase instance.

    Declaration

    Swift

    public init(formatters: [LogFormatter], queue: DispatchQueue? = nil)

    Parameters

    formatters

    An array of LogFormatters to use for formatting log entries to be recorded by the receiver. Each formatter is consulted in sequence, and the formatted string returned by the first formatter to yield a non-nil value will be recorded. If every formatter returns nil, the log entry is silently ignored and not recorded.

    queue

    The DispatchQueue to use for the recorder. If nil, a new queue will be created.

  • This implementation, which does nothing, is present to satisfy the LogRecorder protocol. Subclasses must override this function to provide actual log recording functionality.

    Note

    This function is only called if one of the formatters associated with the receiver returned a non-nil string for the given LogEntry.

    Declaration

    Swift

    open func record(message: String, for entry: LogEntry, currentQueue: DispatchQueue, synchronousMode: Bool)

    Parameters

    message

    The message to record.

    entry

    The LogEntry for which message was created.

    currentQueue

    The GCD queue on which the function is being executed.

    synchronousMode

    If true, the recording is being done in synchronous mode, and the recorder should act accordingly.