mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-29 12:45:37 +08:00
Remove log level 'log' from JS
Summary: Log level 'log' from JS should be equivalent to 'info'. Also added knowledge of 'trace' log level in RCTLog. public Reviewed By: vjeux Differential Revision: D2615500 fb-gh-sync-id: 7a02f49bf7953c1a075741c21e984470c44b5551
This commit is contained in:
committed by
facebook-github-bot-5
parent
824858c6b2
commit
d9b4c57e12
@@ -26,10 +26,11 @@
|
||||
static NSString *const RCTLogFunctionStack = @"RCTLogFunctionStack";
|
||||
|
||||
const char *RCTLogLevels[] = {
|
||||
"trace",
|
||||
"info",
|
||||
"warn",
|
||||
"error",
|
||||
"mustfix"
|
||||
"fatal",
|
||||
};
|
||||
|
||||
#if RCT_DEBUG
|
||||
@@ -65,6 +66,9 @@ RCTLogFunction RCTDefaultLogFunction = ^(
|
||||
|
||||
int aslLevel;
|
||||
switch(level) {
|
||||
case RCTLogLevelTrace:
|
||||
aslLevel = ASL_LEVEL_DEBUG;
|
||||
break;
|
||||
case RCTLogLevelInfo:
|
||||
aslLevel = ASL_LEVEL_NOTICE;
|
||||
break;
|
||||
@@ -210,9 +214,8 @@ void _RCTLogInternal(
|
||||
logFunction(level, fileName ? @(fileName) : nil, (lineNumber >= 0) ? @(lineNumber) : nil, message);
|
||||
}
|
||||
|
||||
#if RCT_DEBUG // Red box is only available in debug mode
|
||||
|
||||
// Log to red box
|
||||
#if RCT_DEBUG
|
||||
// Log to red box in debug mode.
|
||||
if ([UIApplication sharedApplication] && level >= RCTLOG_REDBOX_LEVEL) {
|
||||
NSArray<NSString *> *stackSymbols = [NSThread callStackSymbols];
|
||||
NSMutableArray<NSDictionary *> *stack =
|
||||
@@ -238,9 +241,7 @@ void _RCTLogInternal(
|
||||
}
|
||||
|
||||
// Log to JS executor
|
||||
[[RCTBridge currentBridge] logMessage:message level:level ? @(RCTLogLevels[level - 1]) : @"info"];
|
||||
|
||||
[[RCTBridge currentBridge] logMessage:message level:level ? @(RCTLogLevels[level]) : @"info"];
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user