public struct OSLogRecorder: LogRecorder
OSLogRecorder is an implemention of the
LogRecorder protocol that
records log entries using the new unified logging system available
as of iOS 10.0, macOS 10.12, tvOS 10.0, and watchOS 3.0.
LogTypeTranslator is specified during construction, the
OSLogRecorder will record log messages with an
This is consistent with the behavior of
os_log()function is available at runtime.
public static let isAvailable: Bool =
OSLogused to perform logging.
public let log: OSLog
The GCD queue used by the receiver to record messages.
public let queue: DispatchQueue
OSLogRecorderinstance, which will record log entries using the
os_log()is only supported as of iOS 10.0, macOS 10.12, tvOS 10.0, and watchOS 3.0. On incompatible systems, this initializer will fail.
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 (and subsequent formatters, if any, are skipped). The log entry is silently ignored and not recorded if every formatter returns
The name of the subsystem performing the logging. Defaults to the empty string (
"") if not specified.
OSLogTypeTranslatorvalue that governs how
OSLogTypevalues are determined for log entries.
DispatchQueueto use for the recorder. If
nil, a new queue will be created.
Called to record the specified using the
public 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.