ClientLogger

public final class ClientLogger

A Client logger.

  • A customizable logger block. By default error messages will print to the console, but you can customize it to use own logger.

    Declaration

    Swift

    public static var logger: (_ icon: String, _ dateTime: String, _ message: String) -> Void

    Parameters

    icon

    a small icon string like a tag for messages, e.g. 🦄

    dateAndTime

    a formatted string of date and time, could be empty.

    message

    a message.

  • Init a client logger.

    Declaration

    Swift

    public init(icon: String)

    Parameters

    icon

    a string icon.

  • Undocumented

    Declaration

    Swift

    public func log(_ endpoint: TargetType)
  • Log URL response.

    Declaration

    Swift

    public func log(_ response: URLResponse?, data: Data?)

    Parameters

    response

    an URL response.

    data

    a response data.

    forceToShowData

    force to always log a data.

  • Log an error.

    Declaration

    Swift

    public static func log(_ icon: String = "",
                           _ error: Error?,
                           message: String? = nil,
                           function: String = #function,
                           line: Int = #line)

    Parameters

    icon

    a string icon, e.g. emoji.

    error

    an error.

    message

    an additional message (optional).

    function

    a callee function (auto).

    line

    a callee line of a code in a function (auto).

  • Log a data as a pretty printed JSON string.

    Declaration

    Swift

    public func log(_ identifier: String, _ data: Data?)

    Parameters

    identifier

    an identifier.

    data

    a data.

  • Log a message with an identifier.

    Declaration

    Swift

    public func log(_ identifier: String, _ message: String)

    Parameters

    identifier

    an identifier.

    message

    a message.

  • Log a message.

    Declaration

    Swift

    public func log(_ message: String)

    Parameters

    message

    a message.

  • Log a message.

    Declaration

    Swift

    public static func log(_ icon: String, dateTime: String = "", _ message: String)

    Parameters

    icon

    a string icon, e.g. emoji.

    dateTime

    a date time as a string.

    message

    a message.