Logging in native iOS (Objective-C)

improve this page | report issue

Logging example for native iOS (Objective-C)

Outputs to Xcode console

#import "OCLogger.h"

+ (int) sum:(int) a with:(int) b{
    int sum = a + b;
    OCLogger* mathLogger = [OCLogger getInstanceWithPackage:@"MathUtils"];
    NSString* logMessage = [NSString stringWithFormat:@"sum called with args %d and %d. Returning %d", a, b, sum];
    [mathLogger debug:logMessage];

    return sum;

API calls for specific tasks

Log capture is enabled by default. To turn log capture on or off:


The default capture level is DEBUG in development and FATAL in production. To control the capture level (verbosity):


Log sending is enabled by default. To turn automatic log sending on or off:


For more information about OCLogger API, see the API reference in the user documentation

Last modified on November 09, 2016