ParsableLogFormatter
open class ParsableLogFormatter: StandardLogFormatter
A LogFormatter configured to be ideal for writing machine-parsable log files.
By default, this formatter:
- Uses
.unixas theTimestampStyle - Uses
.numericas theSeverityStyle - Uses
.hexas theCallingThreadStyle - Uses
.tabas theDelimiterStyle - Outputs the source code filename and line number of the call site
Each of these settings can be overridden during instantiation.
-
Initializes a new
ParsableLogFormatterinstance.Declaration
Swift
public override init(timestampStyle: TimestampStyle? = .unix, severityStyle: SeverityStyle? = .numeric, delimiterStyle: DelimiterStyle? = .tab, callingThreadStyle: CallingThreadStyle? = .hex, showCallSite: 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.callingThreadStyleIf provided, specifies a
CallingThreadStyleto use for representing the calling thread. Ifnil, the calling thread is not shown.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.
View on GitHub
ParsableLogFormatter Class Reference