iPhone RestKit how to enable RKLogDebug?

ios, iphone, logging, objective-c, restkit

Solution

You want to add something like this:

    RKLogConfigureByName("RestKit", RKLogLevelWarning); 
    RKLogConfigureByName("RestKit/ObjectMapping", RKLogLevelTrace);
    RKLogConfigureByName("RestKit/Network", RKLogLevelTrace);

to your code. See RKLog.h for the various levels. It is pretty trick.

N.B. this supports a wildcard at the end so, e.g.,

    RKLogConfigureByName("*", RKLogLevelTrace); // set all logs to trace,
    RKLogConfigureByName("RestKit*", RKLogLevelWarning); // set all RestKit logs to warning (leaving the app-specific log untouched). 

– Thanks Kevin!

For Swift user use this syntex:

    RKlcl_configure_by_name("RestKit/Network", RKlcl_vTrace.rawValue)  
    RKlcl_configure_by_na`enter code here`me("RestKit/ObjectMapping", RKlcl_vOff.rawValue) 

– Thanks Darshit!

Problem

I'm trying to debug RestKit object mapping and noticed that there are calls to `RKLogDebug` throughout the code, but it appears that that macro is undefined somewhere. How can I enable it?

Original source

Related problems