Skip to content

Instantly share code, notes, and snippets.

@brunobar79
Created January 23, 2016 02:04
Show Gist options
  • Save brunobar79/7e84b9d3424475d6483c to your computer and use it in GitHub Desktop.
Save brunobar79/7e84b9d3424475d6483c to your computer and use it in GitHub Desktop.
Using CLS_LOG in React Native Logs
RCTLogFunction CrashlyticsReactLogFunction = ^(
RCTLogLevel level,
__unused RCTLogSource source,
NSString *fileName,
NSNumber *lineNumber,
NSString *message
)
{
NSString *log = RCTFormatLog([NSDate date], level, fileName, lineNumber, message);
#ifdef DEBUG
fprintf(stderr, "%s\n", log.UTF8String);
fflush(stderr);
#else
CLS_LOG(@"REACT LOG: %s", log.UTF8String);
#endif
int aslLevel;
switch(level) {
case RCTLogLevelTrace:
aslLevel = ASL_LEVEL_DEBUG;
break;
case RCTLogLevelInfo:
aslLevel = ASL_LEVEL_NOTICE;
break;
case RCTLogLevelWarning:
aslLevel = ASL_LEVEL_WARNING;
break;
case RCTLogLevelError:
aslLevel = ASL_LEVEL_ERR;
break;
case RCTLogLevelFatal:
aslLevel = ASL_LEVEL_CRIT;
break;
}
asl_log(NULL, NULL, aslLevel, "%s", message.UTF8String);
};
@oleg-moseyko
Copy link

CLS_LOG(@"REACT LOG: %s", log.UTF8String); ::::>>>>

Implicit declaration of function 'CLS_LOG' is invalid in C99

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment