/ gist

17. Swift gist: Shortest URL Request logger ever

Here is the shortest URL Request logger ever. I am using URLProtocol subclass to log the request. If you know Timberjack you must be familiar this approach, but instead of implementing all the protocol methods, I did a little trick here...

class LoggerProtocol: URLProtocol {

    override class func canInit(with request: URLRequest) -> Bool {
        print(request)
        return false
    }
}

URLProtocol.registerClass(LoggerProtocol.self)