CocoaPods trunk is moving to be read-only. Read more on the blog, there are 19 months to go.
TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2014 |
Maintained by MUSTLab.
In your App Delegate just add these lines for basic setup (this will enable requests& responses logging from global NSURLSession and NSURLConnection):
#import <MLNetworkLogger.h>
In your application:didFinishLaunchingWithOptions:
just add:
[[MLNetworkLogger sharedLogger] startLogging];
and you are ready to go! But you can do a lot more with customizations...
[[MLNetworkLogger sharedLogger] addAdapter:[MLAFNetworkingAdapter new]];
[[MLNetworkLogger sharedLogger] setLogDetalization:MLNetworkLoggerLogDetalizationHigh];
[[MLNetworkLogger sharedLogger] setRequestFilter:[MLHostnameRequestFilter filterWithHostnames:@[@"apple.com"]]];
NOTE: Currently we only have hostname filter preinstalled, which you can use to log network traffic only from specific hosts, or match them with RegEx pattern. And still you can write your own filter and do a pull request to make it available to everybody.
[[MLNetworkLogger sharedLogger] setRequestLogFormat:MLNetworkLoggerRequestLogFormatCURL];
Currently we support only AFNetworking, so to log from it just add this:
[[MLNetworkLogger sharedLogger] addAdapter:[MLAFNetworkingAdapter new]];
NOTE: we know that AFNetworking uses native NSURLSession/NSURLConnection classes to operate with requests and responses, but the problem is that it creates it's own NSURLSession object which can be logged only by the AFNetworking framework itself and is not accessible from any external framework. So you need this option only if you use AFNetworking with AFURLSessionManager API.
To run the example project, clone the repo, and run pod try MLNetworkLogger
MUSTLab Developer, [email protected]
MLNetworkLogger is available under the MIT license. See the LICENSE file for more info.