ReadableLogFormatter
open class ReadableLogFormatter: StandardLogFormatter
A LogFormatter configured 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.
-
Initializes a new
ReadableLogFormatterinstance.Declaration
Swift
public override init(timestampStyle: TimestampStyle? = .default, severityStyle: SeverityStyle? = .simple, delimiterStyle: DelimiterStyle? = nil, 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
ReadableLogFormatter Class Reference