Getting RKLogConfigureByName working in RubyMotion

Just a quick note, I was getting an undefined constant error for RKLogConfigureByName, the standard way of setting up logging in RestKit. It seems that the #define statements in the /vendor/Pods/RestKit/Code/Support/RKLog.h file are not getting picked up. I am using the pod and loading with RubyMotion pod support, so Iåm not sure what the issue is. I will need to investigate further but this quick workaround works, just call the lower-level method mapped via the #define. For example instead of RKLogConfigureByName use RKlcl_configure_by_name. I also list all the RKlcl_v constants to use instead of the RKLogLevel constants. I also included an example of how they are used, in this case I have put the setup in a method, and it gets called from the the standard didFinishLaunchingWithOption application block.

app_delegate.rblink
def init_restkit_logging
#define RKLogLevelOff -> RKlcl_vOff
#define RKLogLevelCritical -> RKlcl_vCritical
#define RKLogLevelError -> RKlcl_vError
#define RKLogLevelWarning -> RKlcl_vWarning
#define RKLogLevelInfo -> RKlcl_vInfo
#define RKLogLevelDebug -> RKlcl_vDebug
#define RKLogLevelTrace -> RKlcl_vTrace
# "restkit" "RestKit"
# "restkit.network" "RestKit/Network"
# "restkit.network.cache" "RestKit/Network/Cache"
# "restkit.network.queue" "RestKit/Network/Queue"
# "restkit.network.reachability" "RestKit/Network/Reachability"
# "restkit.object_mapping" "RestKit/ObjectMapping"
# "restkit.core_data" "RestKit/CoreData"
# "restkit.core_data.cache" "RestKit/CoreData/Cache"
# "restkit.core_data.search_engine" "RestKit/CoreData/SearchEngine"
# "restkit.support" "RestKit/Support"
# "restkit.support.parsers" "RestKit/Support/Parsers"
# "restkit.three20" "RestKit/Three20"
# "restkit.ui" "RestKit/UI"
# "restkit.testing" "RestKit/Testing"
# "app" "App"
RKlcl_configure_by_name("Restkit", RKlcl_vDebug)
RKlcl_configure_by_name("App", RKlcl_vDebug)
RKlcl_configure_by_name("RestKit/Network*", RKlcl_vTrace)
RKlcl_configure_by_name("RestKit/ObjectMapping", RKlcl_vTrace)
end

Comments