Logger

public protocol Logger

Describes the type you must implement if you wish to provide your own logging implementation.

The only required function to implement is Logger.log(level:message:) as the rest have default implementations.

See also

jqLogger
  • Logs a message.

    Implementations must be thread-safe.

    Declaration

    Swift

    func log(
      level: LogLevel,
      file: StaticString,
      line: UInt,
      function: String,
      message: () -> String
    )

    Parameters

    level

    Describes the level/type of the message.

    file

    The file where the log message comes from.

    line

    The line where the log message comes from.

    function

    The function where the log message comes from.

    message

    A closure which returns the message to display.

  • debug(file:function:line:_:) Default implementation

    Logs a message with level LogLevel.debug.

    Implementations must be thread-safe.

    Default Implementation

    Logs a message with level LogLevel.debug.

    Declaration

    Swift

    func debug(file: StaticString, function: String, line: UInt, _ message: @autoclosure () -> String)

    Parameters

    file

    The file where the log message comes from.

    line

    The line where the log message comes from.

    function

    The function where the log message comes from.

    message

    the message to display. It is an autoclosure so that if that log level is filtered the code will not be evaluated.

  • info(file:function:line:_:) Default implementation

    Logs a message with level LogLevel.info.

    Implementations must be thread-safe.

    Default Implementation

    Logs a message with level LogLevel.info().

    Declaration

    Swift

    func info(file: StaticString, function: String, line: UInt, _ message: @autoclosure () -> String)

    Parameters

    file

    The file where the log message comes from.

    line

    The line where the log message comes from.

    function

    The function where the log message comes from.

    message

    the message to display. It is an autoclosure so that if that log level is filtered the code will not be evaluated.

  • warning(file:function:line:_:) Default implementation

    Logs a message with level LogLevel.warning.

    Implementations must be thread-safe.

    Default Implementation

    Logs a message with level LogLevel.warning.

    Declaration

    Swift

    func warning(
      file: StaticString, function: String, line: UInt, _ message: @autoclosure () -> String)

    Parameters

    file

    The file where the log message comes from.

    line

    The line where the log message comes from.

    function

    The function where the log message comes from.

    message

    the message to display. It is an autoclosure so that if that log level is filtered the code will not be evaluated.

  • error(file:function:line:_:) Default implementation

    Logs a message with level LogLevel.error.

    Implementations must be thread-safe.

    Default Implementation

    Logs a message with level LogLevel.error.

    Declaration

    Swift

    func error(file: StaticString, function: String, line: UInt, _ message: @autoclosure () -> String)

    Parameters

    file

    The file where the log message comes from.

    line

    The line where the log message comes from.

    function

    The function where the log message comes from.

    message

    the message to display. It is an autoclosure so that if that log level is filtered the code will not be evaluated.

  • assert(file:function:line:_:) Default implementation

    Raise an assertion with a message.

    Implementations must be thread-safe.

    Default Implementation

    Raise an assertion.

    Declaration

    Swift

    func assert(
      file: StaticString, function: String, line: UInt, _ message: @autoclosure () -> String)

    Parameters

    file

    The file where the log message comes from.

    line

    The line where the log message comes from.

    function

    The function where the log message comes from.

    message

    the message to display. It is an autoclosure so that if that log level is filtered the code will not be evaluated.

  • Precondition failure with a message.

    Implementations must be thread-safe.

    Default Implementation

    Declaration

    Swift

    func preconditionAssertFailure(
      file: StaticString,
      function: String,
      line: UInt,
      _ message: @autoclosure () -> String
    )

    Parameters

    file

    The file where the log message comes from.

    line

    The line where the log message comes from.

    function

    The function where the log message comes from.

    message

    the message to display. It is an autoclosure so that if that log level is filtered the code will not be evaluated.