ResponseLoggerPlugin

public final class ResponseLoggerPlugin : PluginType

A Moya plugin for printing request info and string representation of the outgoing requests and received responses

  • Plugin constructor

    Declaration

    Swift

    public init(
        logger: Logger,
        descriptors: RequestDescriptor...
    )

    Parameters

    logger

    Logger object that print log items

    descriptors

    List of request descriptors that can produce different representation of the requests

  • PluginType protocol implementation for printing outgoing request

    Declaration

    Swift

    public func willSend(_ request: RequestType, target: TargetType)

    Parameters

    request

    Request object

    target

    Current MoyaTarget object

  • PluginType protocol implementation for printing incoming response

    Declaration

    Swift

    public func didReceive(_ result: Result<Response, MoyaError>, target: TargetType)

    Parameters

    result

    Result object

    target

    Current MoyaTarget object