XcodeLogFormatter
open class XcodeLogFormatter: StandardLogFormatter
A LogFormatter
ideal for use within Xcode.
By default, this formatter:
- Uses
.default
as the defaultTimestampStyle
- Uses
.xcode
as 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.
-
Initializes a new
XcodeLogFormatter
instance.Declaration
Swift
public override init(timestampStyle: TimestampStyle? = .default, severityStyle: SeverityStyle? = .xcode, delimiterStyle: DelimiterStyle? = nil, showCallSite: Bool = true, showCallingThread: Bool = false)
Parameters
timestampStyle
Governs the formatting of the timestamp in the log output. Pass
nil
to suppress output of the timestamp.severityStyle
Governs the formatting of the
LogSeverity
in the log output. Passnil
to suppress output of the severity.delimiterStyle
If provided, overrides the default field separator delimiters. Pass
nil
to use the default delimiters.showCallSite
If
true
, the source file and line indicating the call site of the log request will be added to formatted log messages.showCallingThread
If
true
, a hexadecimal string containing an opaque identifier for the calling thread will be added to formatted log messages.