mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-02-13 17:26:34 +08:00
Fix default logger's loglevel, improve default error handler
Reviewed By: majak Differential Revision: D2834267 fb-gh-sync-id: c89ce5160f03f57409497cc802690c8360d88a4d
This commit is contained in:
committed by
facebook-github-bot-2
parent
52c2533b66
commit
1dffd056bf
@@ -163,7 +163,7 @@ NSString *RCTFormatLog(
|
||||
[log appendString:[formatter stringFromDate:timestamp]];
|
||||
}
|
||||
if (level) {
|
||||
[log appendFormat:@"[%s]", RCTLogLevels[level - 1]];
|
||||
[log appendFormat:@"[%s]", RCTLogLevels[level]];
|
||||
}
|
||||
|
||||
[log appendFormat:@"[tid:%@]", RCTCurrentThreadName()];
|
||||
|
||||
@@ -72,17 +72,12 @@
|
||||
|
||||
/**
|
||||
* This is the error handler that is called when we encounter an exception
|
||||
* when loading a module.
|
||||
* when loading a module. This will report any errors encountered before
|
||||
* ExceptionsManager is configured.
|
||||
*/
|
||||
function setupErrorGuard() {
|
||||
var onError = function(e) {
|
||||
global.console.error(
|
||||
'Error: ' +
|
||||
'\n stack: ' + e.stack +
|
||||
'\n line: ' + e.line +
|
||||
'\n message: ' + e.message,
|
||||
e
|
||||
);
|
||||
global.console.error('Error: ' + e.message + ', stack:\n' + e.stack);
|
||||
};
|
||||
global.ErrorUtils.setGlobalHandler(onError);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user