AFNetworkActivityLogger 2.0.4

AFNetworkActivityLogger 2.0.4

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Mar 2015

Maintained by Mattt Thompson, Kevin Harwood.


Downloads

Total3,885,880
Week0
Month92,433

Installs

Apps16,850
Pod Tries18
Test Targets2,309
Watch Apps40
powered by Segment

GitHub

Stars487
Watchers22
Forks143
Issues10
Contributors6
Pull Requests5

Code

Files2
LOCLines of Code 149


 
Depends on:
AFNetworking/NSURLSession~> 2.0
AFNetworking/NSURLConnection~> 2.0
 

  • By
  • Mattt Thompson

AFNetworkActivityLogger is an extension for AFNetworking 2.0 that logs network requests as they are sent and received.

AFNetworkActivityLogger listens for AFNetworkingOperationDidStartNotification / AFNetworkingOperationDidFinishNotification and AFNetworkingTaskDidStartNotification / AFNetworkingTaskDidFinishNotification notifications, which are posted by AFNetworking as request operations and session tasks are started and finish. For further customization of logging output, users are encouraged to implement desired functionality by listening for these notifications.

Usage

Add the following code to AppDelegate.m -application:didFinishLaunchingWithOptions::

[[AFNetworkActivityLogger sharedLogger] startLogging];

Now all AFURLConnectionOperation and NSURLSessionTask objects created by an AFURLSessionManager will have their request and response logged to the console, a la:

GET http://example.com/foo/bar.json
200 http://example.com/foo/bar.json

If the default logging level is too verbose—say, if you only want to know when requests fail—then changing it is as simple as:

[[AFNetworkActivityLogger sharedLogger] setLevel:AFLoggerLevelError];

Contact

Mattt Thompson

License

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