How can I log each request/response using Alamofire?-open source projects Alamofire/Alamofire

clozach

Something like this might be what you were looking for:

extension Request {
   public func debugLog() -> Self {
      #if DEBUG
         debugPrint(self)
      #endif
      return self
   }
}

Usage:

Alamofire.request(.GET, "http://httpbin.org/get", parameters: ["foo": "bar"])
         .debugLog()
         .response {…}

If you want to print all responses, you could write your own response method, similar to the responseObject() method at the top of this tutorial:

http://www.raywenderlich.com/87595/intermediate-alamofire-tutorial