AFHTTPClientLogger Save

Configurable HTTP request logger for AFNetworking

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:

manager.logger.enabled = YES;

You can configure the log level to control the output's verbosity:

manager.logger.level = AFHTTPClientLogLevelDebug;

You can also customize the output by supplying your own format blocks:

[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

Open Source Agenda is not affiliated with "AFHTTPClientLogger" Project. README Source: jparise/AFHTTPClientLogger
Stars
41
Open Issues
0
Last Commit
8 years ago
License
MIT

Open Source Agenda Badge

Open Source Agenda Rating