Formatter
public protocol Formatter
Log Formatter
-
Timestamp formatter
Declaration
Swift
var timestampFormatter: DateFormatter { get } -
Formatter’s chance to format the log
Declaration
Swift
func processLog(level: Logger.Level, message: Logger.Message, prettyMetadata: String?, file: String, function: String, line: UInt) -> StringParameters
levellog level
messageactual message
prettyMetadataoptional metadata that has already been
prettified
filelog’s originating file
functionlog’s originating function
linelog’s originating line
Return Value
Result of formatting the log
-
Common usage component formatter
Declaration
Swift
public func processComponent(_ component: LogComponent, now: Date, level: Logger.Level, message: Logger.Message, prettyMetadata: String?, file: String, function: String, line: UInt) -> StringParameters
_component to format
nowlog’s Date
levellog level
messageactual message
prettyMetadataoptional metadata that has already been
prettified
filelog’s originating file
functionlog’s originating function
linelog’s originating line
Return Value
Result of formatting the component
View on GitHub
Formatter Protocol Reference