open class RotatingLogFileRecorder: LogRecorderBase
LogRecorder implementation that maintains a set of daily rotating log
files, kept for a user-specified number of days.
RotatingLogFileRecorderinstance assumes full control over the log directory specified by its
directoryPathproperty. Please see the initializer documentation for details.
The number of days for which the receiver will retain log files before they’re eligible for pruning.
open let daysToKeep: Int
The filesystem path to a directory where the log files will be stored.
open let directoryPath: String
Initializes a new
RotatingLogFileRecorderexpects to have full control over the contents of its
directoryPath. Any file not recognized as an active log file will be deleted during the automatic pruning process, which may occur at any time. Therefore, be extremely careful when constructing the value passed in as the
The number of days for which log files should be retained.
The filesystem path of the directory where the log files will be stored. Please note the warning above regarding the
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-
nilvalue will be recorded. If every formatter returns
nil, the log entry is silently ignored and not recorded.
Returns a string representing the filename that will be used to store logs recorded on the given date.
open class func logFilename(forDate date: Date) -> String
Datefor which the log file name is desired.
Called by the
LogReceptacleto record the specified log message.
This function is only called if one of the
formattersassociated with the receiver returned a non-
nilstring for the given
open override func record(message: String, for entry: LogEntry, currentQueue: DispatchQueue, synchronousMode: Bool)
The message to record.
The GCD queue on which the function is being executed.
true, the recording is being done in synchronous mode, and the recorder should act accordingly.