Report logs in dev to server on iOS

Summary:
This diff adds server side logging for all log levels in development (some levels sampled)

There are two new mobile analytic event pipelines (that pipe to scuba table)

- rn_dev_logs ([pigeon](https://our.intern.facebook.com/intern/marauder/event/?name=rn_dev_logs) [scuba](https://fburl.com/scuba/pqxl6mf5))
- rn_dev_logs_sampled ([pigeon](https://our.intern.facebook.com/intern/marauder/event/?name=rn_dev_logs_sampled) [scuba](https://fburl.com/scuba/oqz6b5x3))

Notes:
- All React Native logs from JS and Native on iOS go through this path to be printed to the console, so everything will be caputured even though native errors/warnings do not necessarily show a red/yellow box
- All errors and warnings are logged
- Log level info is sampled

Reviewed By: sammy-SC

Differential Revision: D17789494

fbshipit-source-id: dea6359237dbd91f267949f5185a0c79bb4083b8
This commit is contained in:
Rick Hanlon
2019-10-07 11:44:11 -07:00
committed by Facebook Github Bot
parent 9cefc96e43
commit c71bbb0057
2 changed files with 29 additions and 0 deletions
+10
View File
@@ -78,6 +78,16 @@ RCT_EXTERN NSString *RCTFormatLog(
NSString *message
);
/**
* A method to generate a string RCTLogLevel
*/
RCT_EXTERN NSString *RCTFormatLogLevel(RCTLogLevel);
/**
* A method to generate a string from a RCTLogSource
*/
RCT_EXTERN NSString *RCTFormatLogSource(RCTLogSource);
/**
* The default logging function used by RCTLogXX.
*/
+19
View File
@@ -162,6 +162,25 @@ NSString *RCTFormatLog(
return log;
}
NSString *RCTFormatLogLevel(RCTLogLevel level)
{
NSDictionary *levelsToString = @{@(RCTLogLevelTrace) : @"trace",
@(RCTLogLevelInfo) : @"info",
@(RCTLogLevelWarning) : @"warning",
@(RCTLogLevelFatal) : @"fatal",
@(RCTLogLevelError) : @"error"};
return levelsToString[@(level)];
}
NSString *RCTFormatLogSource(RCTLogSource source)
{
NSDictionary *sourcesToString = @{@(RCTLogSourceNative) : @"native",
@(RCTLogSourceJavaScript) : @"js"};
return sourcesToString[@(source)];
}
static NSRegularExpression *nativeStackFrameRegex()
{
static dispatch_once_t onceToken;