ReadableLogFormatter
open class ReadableLogFormatter: StandardLogFormatter
A LogFormatter configured to be ideal for writing human-readable log files.
By default, this formatter:
- Uses
.defaultas theTimestampStyle - Uses a custom
SeverityStylethat pads the capitalized severity name - Uses
.hexas theCallingThreadStyle - Uses default field separator delimiters
- Outputs the source code filename and line number of the call site
Each of these settings can be overridden during instantiation.
-
Initializes a new
ReadableLogFormatterinstance.Declaration
Swift
public override init(timestampStyle: TimestampStyle? = .default, severityStyle: SeverityStyle? = .custom(textRepresentation: .capitalized, truncateAtWidth: 7, padToWidth: 7, rightAlign: false), delimiterStyle: DelimiterStyle? = nil, 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.delimiterStyleIf provided, overrides the default field separator delimiters. Pass
nilto use the default delimiters.callingThreadStyleIf provided, specifies a
CallingThreadStyleto use for representing the calling thread. Ifnil, the calling thread is not shown.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
ReadableLogFormatter Class Reference