mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-22 20:18:53 +08:00
Added special 'App' logging component for logging messages via RKLog() from your app. closes #183
This commit is contained in:
@@ -9,3 +9,13 @@
|
||||
#import "Network/Network.h"
|
||||
#import "Support/Support.h"
|
||||
#import "ObjectMapping/ObjectMapping.h"
|
||||
|
||||
/**
|
||||
Set the App logging component. This header
|
||||
file is generally only imported by apps that
|
||||
are pulling in all of RestKit. By setting the
|
||||
log component to App here, we allow the app developer
|
||||
to use RKLog() in their own app.
|
||||
*/
|
||||
#undef RKLogComponent
|
||||
#define RKLogComponent lcl_cApp
|
||||
|
||||
@@ -96,6 +96,15 @@ lcl_log(RKLogComponent, lcl_vTrace, @"" __VA_ARGS__);
|
||||
RKLogInitialize(); \
|
||||
lcl_configure_by_name(name, level);
|
||||
|
||||
/**
|
||||
Alias for configuring the LibComponentLogger logging component for the App. This
|
||||
enables the end-user of RestKit to leverage RKLog() to log messages inside of
|
||||
their apps.
|
||||
*/
|
||||
#define RKLogSetAppLoggingLevel(level) \
|
||||
RKLogInitialize(); \
|
||||
lcl_configure_by_name("App", level);
|
||||
|
||||
/**
|
||||
Set the Default Log Level
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ static BOOL loggingInitialized = NO;
|
||||
void RKLogInitialize() {
|
||||
if (loggingInitialized == NO) {
|
||||
lcl_configure_by_name("RestKit*", RKLogLevelDefault);
|
||||
lcl_configure_by_name("App", RKLogLevelDefault);
|
||||
RKLogInfo(@"RestKit initialized...");
|
||||
loggingInitialized = YES;
|
||||
}
|
||||
|
||||
@@ -44,3 +44,4 @@ _lcl_component(RestKitNetworkQueue, "restkit.network.queue", "Res
|
||||
_lcl_component(RestKitNetworkReachability, "restkit.network.reachability", "RestKit/Network/Reachability")
|
||||
_lcl_component(RestKitObjectMapping, "restkit.object_mapping", "RestKit/ObjectMapping")
|
||||
_lcl_component(RestKitCoreData, "restkit.core_data", "RestKit/CoreData")
|
||||
_lcl_component(App, "app", "App")
|
||||
@@ -158,7 +158,7 @@ static NSString* const kDBAccessTokenHTTPHeaderField = @"X-USER-ACCESS-TOKEN";
|
||||
via calls to RKLogConfigureByName as detailed below.
|
||||
|
||||
See RKLog.h and lcl_log_components.h for details on the logging macros available
|
||||
*/
|
||||
*/
|
||||
RKLogConfigureByName("RestKit", RKLogLevelTrace);
|
||||
RKLogConfigureByName("RestKit/Network", RKLogLevelDebug);
|
||||
RKLogConfigureByName("RestKit/ObjectMapping", RKLogLevelDebug);
|
||||
@@ -167,6 +167,18 @@ static NSString* const kDBAccessTokenHTTPHeaderField = @"X-USER-ACCESS-TOKEN";
|
||||
// Enable boatloads of trace info from the mapper
|
||||
// RKLogConfigureByName("RestKit/ObjectMapping", RKLogLevelTrace);
|
||||
|
||||
/**
|
||||
Enable verbose logging for the App component.
|
||||
|
||||
This component is exported by RestKit to allow you to leverage the same logging
|
||||
facilities and macros in your app that are used internally by the library. When
|
||||
you #import <RestKit/RestKit.h>, the default logging component is set to 'App'
|
||||
for you. Calls to RKLog() within your application will log at the level specified below.
|
||||
*/
|
||||
RKLogSetAppLoggingLevel(RKLogLevelTrace);
|
||||
|
||||
RKLogDebug(@"Discussion Board is starting up...");
|
||||
|
||||
// Initialize Three20
|
||||
TTURLMap* map = [[TTNavigator navigator] URLMap];
|
||||
[map from:@"db://topics" toViewController:[DBTopicsTableViewController class]];
|
||||
|
||||
Reference in New Issue
Block a user