Skip to content

AFNetworking 2.0 Extension for Network Request Logging with Cocoa Lumberjack

License

Notifications You must be signed in to change notification settings

RomainBoulay/AFNetworkLumberjackLogger

 
 

Repository files navigation

AFNetworkLumberjackLogger

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

AFNetworkLumberjackLogger 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::

[[AFNetworkLumberjackLogger 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:

[[AFNetworkLumberjackLogger sharedLogger] setLevel:AFLoggerLevelError];

Contact

Mattt Thompson

License

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

About

AFNetworking 2.0 Extension for Network Request Logging with Cocoa Lumberjack

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 94.6%
  • Ruby 5.4%