https://github.com/jparise/afhttpclientlogger
Configurable HTTP request logger for AFNetworking
https://github.com/jparise/afhttpclientlogger
afnetworking
Last synced: 10 months ago
JSON representation
Configurable HTTP request logger for AFNetworking
- Host: GitHub
- URL: https://github.com/jparise/afhttpclientlogger
- Owner: jparise
- License: mit
- Created: 2012-10-25T21:02:03.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2016-02-10T01:15:18.000Z (almost 10 years ago)
- Last Synced: 2024-05-02T00:07:12.470Z (over 1 year ago)
- Topics: afnetworking
- Language: Objective-C
- Size: 15.6 KB
- Stars: 41
- Watchers: 7
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AFHTTPClientLogger
AFHTTPClientLogger is a request logging extension for [AFNetworking][]. It
provides configurable HTTP request logging features on a per `AFHTTPRequestOperationManager`
instance basis.
It is conceptually similar to [AFHTTPRequestOperationLogger][], which works
globally across all `AFHTTPRequestOperationManager` instances.
AFHTTPClientLogger supports logging via [CocoaLumberjack][] and will use its logging methods over `NSLog` if it's available.
## Usage
The logger is accessed via the `logger` property of an `AFHTTPRequestOperationManager` object
instance (simply named `manager` in the examples below). It must be explicitly
enabled:
```objective-c
manager.logger.enabled = YES;
```
You can configure the log level to control the output's verbosity:
```objective-c
manager.logger.level = AFHTTPClientLogLevelDebug;
```
You can also customize the output by supplying your own format blocks:
```objective-c
[manager.logger setRequestStartFormatBlock:^NSString *(AFHTTPRequestOperation *operation, AFHTTPClientLogLevel level) {
if (level > AFHTTPClientLogLevelInfo) {
return nil;
}
return [NSString stringWithFormat:@"%@ %@", [operation.request HTTPMethod], [[operation.request URL] absoluteString]];
}];
```
## License
AFHTTPClientLogger is available under the MIT license. See the included
LICENSE file for details.
## Contact
- Email: jon@indelible.org
- GitHub: [@jparise](https://github.com/jparise)
- Twitter: [@jparise](https://twitter.com/jparise)
[AFNetworking]: http://afnetworking.com/
[AFHTTPRequestOperationLogger]: https://github.com/AFNetworking/AFHTTPRequestOperationLogger
[CocoaLumberjack]: https://github.com/CocoaLumberjack/CocoaLumberjack