Logger

public protocol Logger

Capable of logging messages.

logger.info("This is an informational log")

The above code yields:

[ INFO ] This is an informational log (/path/to/file.swift:42)
  • Logs an encodable at the provided log level The encodable can be encoded to the required format. The log level indicates the type of log and/or severity

    Normally, you will use one of the convenience methods (i.e., verbose(...), info(...)).

    Declaration

    Swift

    func log(_ string: String, at level: LogLevel, file: String, function: String, line: UInt, column: UInt)
  • Verbose logs are used to log tiny, usually irrelevant information. They are helpful when tracing specific lines of code and their results

    Declaration

    Swift

    public func verbose(_ string: String, file: String = #file, function: String = #function, line: UInt = #line, column: UInt = #column)
  • Debug logs are used to debug problems

    Declaration

    Swift

    public func debug(_ string: String, file: String = #file, function: String = #function, line: UInt = #line, column: UInt = #column)
  • Info logs are used to indicate a specific infrequent event occurring.

    Declaration

    Swift

    public func info(_ string: String, file: String = #file, function: String = #function, line: UInt = #line, column: UInt = #column)
  • Warnings are used to indicate something should be fixed but may not have to be solved yet

    Declaration

    Swift

    public func warning(_ string: String, file: String = #file, function: String = #function, line: UInt = #line, column: UInt = #column)
  • Error, indicates something went wrong and a part of the execution was failed.

    Declaration

    Swift

    public func error(_ string: String, file: String = #file, function: String = #function, line: UInt = #line, column: UInt = #column)
  • Fatal errors/crashes, execution should/must be cancelled.

    Declaration

    Swift

    public func fatal(_ string: String, file: String = #file, function: String = #function, line: UInt = #line, column: UInt = #column)