BufferedMessageRecorder

open class BufferedMessageRecorder: BufferedLogRecorder<String>

The BufferedMessageRecorder buffers the formatted log messages passed to its record() function.

  • Initializes a new BufferedMessageRecorder.

    Declaration

    Swift

    public init(formatters: [LogFormatter], bufferLimit: Int = 10_000, 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.

    bufferLimit

    If this value is positive, it specifies the maximum number of items to store in the buffer. If record() is called when the buffer limit has been reached, the oldest item in the buffer will be dropped. If this value is zero or negative, no limit will be applied. Note that this is potentially dangerous in production code, since memory consumption will grow endlessly unless you manually clear the buffer periodically.

    queue

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