OAuth2Logger

public protocol OAuth2Logger

A simple protocol for loggers used in OAuth2.

The OAuth2DebugLogger is a simple implementation that logs to stdout. If you need more sophisticated logging, just adapt this protocol and set your logger on the OAuth2 instance you’re using.

  • The logger’s logging level.

    Declaration

    Swift

    var level: OAuth2LogLevel { get }
  • This is made a protocol method so it can be implemented in extension OAuth2Logger and you’re able to create your own class that overrides this method so you can write your own implementation.

    Default Implementation

    The main log method, figures out whether to log the given message based on the receiver’s logging level, then just uses print. Ignores filename, line and function. If you override this method in your own logger there’s no need to override the trace, debug and warn methods implemented below as they all call out to this one.

    Declaration

    Swift

    func log(_ atLevel: OAuth2LogLevel, module: String?, filename: String?, line: Int?, function: String?, msg: @autoclosure() -> String)
  • trace(_:filename:line:function:msg:) Default implementation

    Log a message at the trace level.

    Default Implementation

    Log a message at the trace level.

    Declaration

    Swift

    func trace(_ module: String?, filename: String?, line: Int?, function: String?, msg: @autoclosure() -> String)
  • debug(_:filename:line:function:msg:) Default implementation

    Standard debug logging.

    Default Implementation

    Standard debug logging.

    Declaration

    Swift

    func debug(_ module: String?, filename: String?, line: Int?, function: String?, msg: @autoclosure() -> String)
  • warn(_:filename:line:function:msg:) Default implementation

    Log warning messages.

    Default Implementation

    Log warning messages.

    Declaration

    Swift

    func warn(_ module: String?, filename: String?, line: Int?, function: String?, msg: @autoclosure() -> String)