Classes

The following classes are available globally.

  • A LogRecorder implementation that maintains a set of daily rotating log files, kept for a user-specified number of days.

    Important

    A RotatingLogFileRecorder instance assumes full control over the log directory specified by its directoryPath property. Please see the initializer documentation for details.
    See more

    Declaration

    Swift

    open class RotatingLogFileRecorder: LogRecorderBase
  • A LogRecorder implementation that appends log entries to a file.

    Note

    FileLogRecorder is a simple log appender that provides no mechanism for file rotation or truncation. Unless you manually manage the log file when a FileLogRecorder doesn’t have it open, you will end up with an ever-growing file. Use a RotatingLogFileRecorder instead if you’d rather not have to concern yourself with such details.
    See more

    Declaration

    Swift

    open class FileLogRecorder: LogRecorderBase
  • The FieldBasedLogFormatter provides a simple interface for constructing a customized LogFormatter by specifying different fields.

    Let’s say you wanted to construct a LogFormatter that outputs the following fields separated by tabs:

    • The LogEntry’s timestamp property as a UNIX time value
    • The severity of the LogEntry as a numeric value
    • The Payload of the LogEntry

    You could do this by constructing a FieldBasedLogFormatter as follows:

    let formatter = FieldBasedLogFormatter(fields: [.Timestamp(.UNIX),
                                                    .Delimiter(.Tab),
                                                    .Severity(.Numeric),
                                                    .Delimiter(.Tab),
                                                    .Payload])
    
    See more

    Declaration

    Swift

    open class FieldBasedLogFormatter: ConcatenatingLogFormatter
  • LogReceptacles provide the low-level interface for accepting log messages.

    Although you could use a LogReceptacle directly to perform all logging functions, the Log implementation provides a higher-level interface that’s more convenient to use within your code.

    See more

    Declaration

    Swift

    public final class LogReceptacle
  • A LogFormatter ideal for use within Xcode.

    By default, this formatter:

    • Uses .default as the default TimestampStyle
    • Uses .xcode as the default SeverityStyle
    • Uses default field separator delimiters
    • Outputs the call site
    • Does not output the calling thread

    These defaults can be overridden by providing alternate values to the initializer.

    See more

    Declaration

    Swift

    open class XcodeLogFormatter: StandardLogFormatter