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) -> String
Parameters
level
log level
message
actual message
prettyMetadata
optional metadata that has already been
prettified
file
log’s originating file
function
log’s originating function
line
log’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) -> String
Parameters
_
component to format
now
log’s Date
level
log level
message
actual message
prettyMetadata
optional metadata that has already been
prettified
file
log’s originating file
function
log’s originating function
line
log’s originating line
Return Value
Result of formatting the component