SeverityLogFormatter

public struct SeverityLogFormatter: LogFormatter

A LogFormatter that returns a string representation of the passed-in LogEntry‘s severity.

This is typically combined with other LogFormatters within a ConcatenatingLogFormatter.

  • The SeverityStyle that determines the return value of the receiver’s format(_:) function.

    Declaration

    Swift

    public let style: SeverityStyle
  • Initializes a new SeverityLogFormatter to use the specified SeverityStyle when formatting output.

    Declaration

    Swift

    public init(style: SeverityStyle = .simple)

    Parameters

    style

    The SeverityStyle to use.

  • Formats the passed-in LogEntry by returning a string representation of its severity property.

    Declaration

    Swift

    public func format(_ entry: LogEntry)
            -> String?

    Parameters

    entry

    The LogEntry to be formatted.

    Return Value

    The formatted result; never nil.