HTTPLogger 0.2.0

HTTPLogger 0.2.0

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Feb 2017
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by muukii, muukii.



  • By
  • muukii

HTTPLogger

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, [email protected]

License

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