LoggingInterceptor

public final class LoggingInterceptor : Interceptor

Implementation of a request interceptor which logs the request information.

  • # Summary The initialiser for the LoggingRequestInterceptor

    Declaration

    Swift

    public init(logger: Logger = DefaultLogger())

    Parameters

    logger

    The logger to be used to pass the request information to. Default value for the logger is the DefaultLogger.

  • # Summary Intercepting the request by taking its information and creating a message to be logged.

    Declaration

    Swift

    public func intercept(_ request: URLRequest) -> URLRequest

    Parameters

    request

    The request to be intercepted.

    Return Value

    The intercepted request.

  • # Summary Intercepting the response by taking its information and creating a message to be logged.

    Declaration

    Swift

    public func intercept(response: URLResponse?, data: Data?, error: Error?) -> URLResponse?

    Parameters

    response

    The response returned by the data task

    data

    The data returned by the data task.

    error

    The error returned by the data task.

    Return Value

    The intercepted response.