Logging in native iOS (Objective-C)

improve this page | report issue

Logging example for native iOS (Objective-C)

Outputs to Xcode console:

#import "OCLoggerMacros.h"
#import "OCLogger+Constants.h"
+ (int) sum:(int) a with:(int) b{
  int sum = a + b;
  OCLoggerDebugWithPackage(@"MathUtils", @"sum called with args %d and %d. Returning %d", a, b, sum);
 return sum;
}

API calls for specific tasks

Turn log capture on or off:

OCLogger.setCapture(boolean)

Control capture level (verbosity):

OCLogger.setLevel(NSString)

Turn automatic log sending on or off:

OCLogger.setAutoSendLogs(boolean)

Turn automatic configuration retrieval on or off:

OCLogger.setAutoUpdateConfig(boolean)

Last modified on November 09, 2016