ParsableLogFormatter
open class ParsableLogFormatter: StandardLogFormatter
A LogFormatter configured 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.
-
Initializes a new
ParsableLogFormatterinstance.Declaration
Swift
public override init(timestampStyle: TimestampStyle? = .unix, severityStyle: SeverityStyle? = .numeric, delimiterStyle: DelimiterStyle? = .tab, showCallSite: Bool = true, showCallingThread: Bool = true)Parameters
timestampStyleGoverns the formatting of the timestamp in the log output. Pass
nilto suppress output of the timestamp.severityStyleGoverns the formatting of the
LogSeverityin the log output. Passnilto suppress output of the severity.delimiterStyleIf provided, overrides the default field separator delimiters. Pass
nilto use the default delimiters.showCallSiteIf
true, the source file and line indicating the call site of the log request will be added to formatted log messages.showCallingThreadIf
true, a hexadecimal string containing an opaque identifier for the calling thread will be added to formatted log messages.
View on GitHub
ParsableLogFormatter Class Reference