[ReactNative] Back out D2014163 entirely

This commit is contained in:
Philipp von Weitershausen
2015-04-23 11:34:25 -07:00
parent 24095fcc2d
commit e88ba1a6a3
5 changed files with 29 additions and 43 deletions

View File

@@ -23,7 +23,7 @@
log: 1,
info: 2,
warn: 3,
error: 4,
error: 4
};
function setupConsole(global) {
@@ -35,10 +35,8 @@
function getNativeLogFunction(level) {
return function() {
var str = Array.prototype.map.call(arguments, function(arg) {
if (arg === undefined) {
return 'undefined';
} else if (arg === null) {
return 'null';
if (arg == null) {
return arg === null ? 'null' : 'undefined';
} else if (typeof arg === 'string') {
return '"' + arg + '"';
} else {
@@ -50,22 +48,14 @@
if (typeof arg.toString === 'function') {
try {
return arg.toString();
} catch (E) {}
} catch (E) {
return 'unknown';
}
}
return '["' + typeof arg + '" failed to stringify]';
}
}
}).join(', ');
global.nativeLoggingHook(str, level);
if (global.reportException && level === LOG_LEVELS.error) {
var error = new Error(str);
error.framesToPop = 1;
// TODO(sahrens): re-enable this when we have a way to turn
// it off by default for MAdMan/Android, and/or all
// consumers of console.error() are fixed, including
// CatalystErrorHandlerModuleTestCase
// global.reportException(error);
}
};
}