An Alamofire network activity logger view
AlamofireLogbook is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'AlamofireLogbook'
To start logging, import the libraray in your network layer and use the method log()
on your Alamofire DataRequest
instance like the following example:
import Alamofire
import AlamofireLogbook
Alamofire
.request("https://httpbin.org/get")
.log()
.responseJSON { response in
// Your code
}
If you want to log each request yourself
- Conform to
AlamofireResponseListener
- implement
recievedResponseFor(item : LogItem)
- assign your delegate class in the app delegate to
AlamofireLogbook.shared.delegate
OR to show the Network activity logs view just call
AlamofireLogbook.show()
and you'll get A full searchable log
Use the action button on the top right of the request details page to copy a readable formatted string of both the request and response. 😉
To try the example project:
run pod try AlamofireLogbook
in your ternimal
or
clone the repo, and run pod install
from the Example directory first.
- iOS 9.0+
- Xcode 9+
- Swift 3.2+
- AlamofireLogbook is a plugin for Alamofire framework
If you have some ideas on how to improve the framework, Fork it, implement your changes and create that pull request already 😉.
All contributions are welcome 🤗.
Built with 💙 by mikeAttia
AlamofireLogbook is available under the MIT license. See the LICENSE file for more info.