/HTTPLogger

Logging HTTP Request of NSURLSession.

Primary LanguageSwiftMIT LicenseMIT

HTTPLogger

CI Status Version License Platform

About

Logging HTTP Request of NSURLSession.

Request Log

Response Log

Usage (Setup)

  • Register NSURLProtocol
HTTPLogger.register()
  • Setup NSURLSessionConfiguration
let configuration = NSURLSessionConfiguration.defaultSessionConfiguration()
HTTPLogger.setup(configuration)

// Sample Alamofire
Alamofire.Manager(configuration: configuration)

Custom

  • Create and Set Configuration
struct Configuration: HTTPLoggerConfigurationType {
  func printLog(string: String) {
    NSLog(string)
  }

  public func enableCapture(request: NSURLRequest) -> Bool {
    #if DEBUG
      return true
    #else
      return false
    #endif
  }
}
HTTPLogger.configuration = Configuration()

Installation

HTTPLogger is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "HTTPLogger"

Author

muukii, m@muukii.me

License

HTTPLogger is available under the MIT license. See the LICENSE file for more info.