StandardLogFormatter

open class StandardLogFormatter: FieldBasedLogFormatter

A standard LogFormatter that provides some common customization points.

  • Initializes a new StandardLogFormatter instance.

    Declaration

    Swift

    public init(timestampStyle: TimestampStyle? = .default, severityStyle: SeverityStyle? = .simple, delimiterStyle: DelimiterStyle? = nil, callingThreadStyle: CallingThreadStyle? = .hex, showCallSite: Bool = true)

    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. Pass nil to suppress output of the severity.

    delimiterStyle

    If provided, overrides the default field separator delimiters. Pass nil to use the default delimiters.

    callingThreadStyle

    If provided, specifies a CallingThreadStyle to use for representing the calling thread. If nil, the calling thread is not shown.

    showCallSite

    If true, the source file and line indicating the call site of the log request will be added to formatted log messages.