TKLogger

public protocol TKLogger

A TKLogger is used by TKLog to perform the outputting and processing of log statements.

A default TKConsoleLogger is provided.

  • The log level of the logger. Used by TKLog to decide whether to sent events to this logger.

    Declaration

    Swift

    var level: TKLog.LogLevel { get }
  • Called by TKLog when an event should be logged.

    Declaration

    Swift

    func output(_ level: TKLog.LogLevel, identifier: String, message: String)

    Parameters

    level

    The log level of the event.

    identifier

    An identifier for who is logging this, typically a class name.

    message

    The log message

  • log(identifier:request:) Default implementation

    Called by TKLog with requests, typically maded by TKServer

    This is optional. By default output will be called if level is less or equal .info

    Default Implementation

    Declaration

    Swift

    func log(identifier: String, request: TKLog.ServerRequest)

    Parameters

    identifier

    An identifier for who is logging this, typically a class name.

    request

    The request that was made

  • log(identifier:response:) Default implementation

    Called by TKLog when server response was received, typically initiated by TKServer

    This is optional. By default output will be called if level is less or equal .info

    Default Implementation

    Declaration

    Swift

    func log(identifier: String, response: TKLog.ServerResponse)

    Parameters

    identifier

    An identifier for who is logging this, typically a class name.

    response

    The response that was received (or error information, if no response received)

  • log(_:identifier:message:) Extension method

    Declaration

    Swift

    func log(_ level: TKLog.LogLevel, identifier: String, message: String)