Classes
The following classes are available globally.
-
A
LogFormatterconfigured to be ideal for writing human-readable log files.By default, this formatter:
- Uses
.defaultas the defaultTimestampStyle - Uses
.simpleas the defaultSeverityStyle - Uses default field separator delimiters
- Outputs the call site and calling thread
These defaults can be overridden during instantiation.
See moreDeclaration
Swift
open class ReadableLogFormatter: StandardLogFormatter - Uses
-
A
LogConfigurationoptimized for use when running within Xcode.The
See moreXcodeLogConfigurationsets up a single recorder: anASLLogRecorderconfigured to echo output tostdoutas well as capturing to the ASL.Declaration
Swift
open class XcodeLogConfiguration: BasicLogConfiguration
-
A
LogRecorderimplementation that maintains a set of daily rotating log files, kept for a user-specified number of days.See moreImportant
ARotatingLogFileRecorderinstance assumes full control over the log directory specified by itsdirectoryPathproperty. Please see the initializer documentation for details.Declaration
Swift
open class RotatingLogFileRecorder: LogRecorderBase
-
The
See moreStandardOutputLogRecorderlogs messages by writing to the standard output stream of the running process.Declaration
Swift
open class StandardOutputLogRecorder: LogRecorderBase
-
A
See moreLogConfigurationthat uses an underlyingRotatingLogFileRecorderto maintain a directory of log files that are rotated on a daily basis.Declaration
Swift
open class RotatingLogFileConfiguration: BasicLogConfiguration
-
In case the name didn’t give it away, the
See moreBasicLogConfigurationclass provides a basic implementation of theLogConfigurationprotocol.Declaration
Swift
open class BasicLogConfiguration: LogConfiguration
-
A
LogRecorderimplementation that appends log entries to a file.See moreNote
FileLogRecorderis a simple log appender that provides no mechanism for file rotation or truncation. Unless you manually manage the log file when aFileLogRecorderdoesn’t have it open, you will end up with an ever-growing file. Use aRotatingLogFileRecorderinstead if you’d rather not have to concern yourself with such details.Declaration
Swift
open class FileLogRecorder: LogRecorderBase
-
The
FieldBasedLogFormatterprovides a simple interface for constructing a customizedLogFormatterby specifying different fields.Let’s say you wanted to construct a
LogFormatterthat outputs the following fields separated by tabs:- The
LogEntry’stimestampproperty as a UNIX time value - The
severityof theLogEntryas a numeric value - The
Payloadof theLogEntry
You could do this by constructing a
FieldBasedLogFormatteras follows:
See morelet formatter = FieldBasedLogFormatter(fields: [.Timestamp(.UNIX), .Delimiter(.Tab), .Severity(.Numeric), .Delimiter(.Tab), .Payload])Declaration
Swift
open class FieldBasedLogFormatter: ConcatenatingLogFormatter - The
-
LogReceptacles provide the low-level interface for accepting log messages.Although you could use a
See moreLogReceptacledirectly to perform all logging functions, theLogimplementation provides a higher-level interface that’s more convenient to use within your code.Declaration
Swift
public final class LogReceptacle
-
The
See moreConcatenatingLogFormatterlets you combine the output of multipleLogFormatters by contatenating their output and returning the result.Declaration
Swift
open class ConcatenatingLogFormatter: LogFormatter
-
A partial implementation of the
See moreLogRecorderprotocol.Declaration
Swift
open class LogRecorderBase: LogRecorder
-
A standard
See moreLogFormatterthat provides some common customization points.Declaration
Swift
open class StandardLogFormatter: FieldBasedLogFormatter
-
A
LogFormatterconfigured to be ideal for writing machine-parsable log files.By default, this formatter:
- Uses
.unixas the defaultTimestampStyle - Uses
.numericas the defaultSeverityStyle - Uses
.tabas the defaultDelimiterStyle - Outputs the call site and calling thread
These defaults can be overridden during instantiation.
See moreDeclaration
Swift
open class ParsableLogFormatter: StandardLogFormatter - Uses
-
A
LogFormatterideal for use within Xcode.By default, this formatter:
- Uses
.defaultas the defaultTimestampStyle - Uses
.xcodeas the defaultSeverityStyle - 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 moreDeclaration
Swift
open class XcodeLogFormatter: StandardLogFormatter - Uses
View on GitHub
Classes Reference