OkLog for iOS and macOS
OkLog-Swift is a network logger written in Swift highly inspired by simonpercic's original OkLog implementation to be used in iOS and macOS projects.
What does it do?
OkLog encodes request & response data and generates an URL from where you can see all those info nicely, making it easy to debug and share network data. Here's an example.
OkLog is integrated with CocoaPods. To use it in your project, add to your
and then don't forget to run:
$ pod install
Swift Package Manager
OkLog is also available through SPM.
URLSession's result closure simply call
OkLog.log(request: request, response: response, data: data)
to get the URL printed in Xcode's console, or
let url = OkLog.getUrl(request: request, response: response, data: data)
to retrieve it and do whatever you want.
If you are using Alamofire, place
let url = OkLog.getUrl(response)
in the request's completion closure.
You can also opt-out from URL shortening by specifying
shortenUrl: false as parameter.
To have the request duration printed in the log you need to tell OkLog right before the request gets executed (this is optional).
An example project is included with a few sample requests using URLSession and Alamofire.
You may find interesting
Fixes - 2019-09-09 22:18:58
Fixes - 2019-09-09 22:17:25
Swift Package Manager - 2019-09-03 02:01:09
Swift 5.0 - 2019-04-02 16:58:01
Swift 4.2 - 2018-09-17 19:13:15
macOS Support - 2018-07-12 12:18:15
URL Shortening opt-out - 2018-07-09 11:03:17
ResponseDuration - 2018-07-05 00:50:38
Added support for "responseDurationMs".