TimestampLogFormatter

public struct TimestampLogFormatter: LogFormatter

A LogFormatter that returns a string representation of a LogEntry‘s timestamp property.

This is typically combined with other LogFormatters within a ConcatenatingLogFormatter.

  • The TimestampStyle that determines how the receiver will format its output.

    Declaration

    Swift

    public let style: TimestampStyle
  • Initializes a new TimestampLogFormatter that will use the specified TimestampStyle.

    Declaration

    Swift

    public init(style: TimestampStyle = .default)

    Parameters

    style

    A TimestampStyle value that will govern the output of the format(_:) function.

  • Formats the passed-in LogEntry by converting its timestamp property into a string.

    Declaration

    Swift

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

    Parameters

    entry

    The LogEntry to be formatted.

    Return Value

    The formatted result; never nil.