mirror of https://github.com/status-im/metro.git
Updates from Wed 18 Mar
- [ReactNative] Add AsyncStorageTest | Spencer Ahrens - [ReactNative] Add timers integration test | Spencer Ahrens - [ReactNative] Remove ExpandingText | Tadeu Zagallo - [TouchableHighlight] Preserve underlay style when restoring inactive props | Christopher Chedeau - clean flow errors in react-native-github | Basil Hosmer - [ReactNative] Sort React Native exports into two groups, Components and APIs | Christopher Chedeau - [ReactNative] Rename Slider to SliderIOS | Tadeu Zagallo - [react_native] JS files from D1919491: Improve JS logging | Martin Kosiba - [ReactNative] Add TimerExample | Spencer Ahrens - [RFC][ReactNative] increase timer resolution | Spencer Ahrens - [ReactNative] Strip prefixes from NativeModules keys | Spencer Ahrens - [ReactNative] Small docs cleanup in ActivityIndicatorIOS and DatePickerIOS | Christopher Chedeau - [ReactNative] Improvements on perf measurement output | Jing Chen - [ReactNative] Clean up Touchable PropTypes | Christopher Chedeau - [ReactKit] Fail tests when redbox shows up | Alex Kotliarskyi
This commit is contained in:
parent
a689113fb4
commit
e3025bb624
|
@ -25,6 +25,13 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var OBJECT_COLUMN_NAME = '(index)';
|
var OBJECT_COLUMN_NAME = '(index)';
|
||||||
|
var LOG_LEVELS = {
|
||||||
|
trace: 0,
|
||||||
|
log: 1,
|
||||||
|
info: 2,
|
||||||
|
warn: 3,
|
||||||
|
error: 4
|
||||||
|
};
|
||||||
|
|
||||||
function setupConsole(global) {
|
function setupConsole(global) {
|
||||||
|
|
||||||
|
@ -32,7 +39,8 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function doNativeLog() {
|
function getNativeLogFunction(level) {
|
||||||
|
return function() {
|
||||||
var str = Array.prototype.map.call(arguments, function(arg) {
|
var str = Array.prototype.map.call(arguments, function(arg) {
|
||||||
if (arg == null) {
|
if (arg == null) {
|
||||||
return arg === null ? 'null' : 'undefined';
|
return arg === null ? 'null' : 'undefined';
|
||||||
|
@ -54,7 +62,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).join(', ');
|
}).join(', ');
|
||||||
global.nativeLoggingHook(str);
|
global.nativeLoggingHook(str, level);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
var repeat = function(element, n) {
|
var repeat = function(element, n) {
|
||||||
|
@ -75,7 +84,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rows.length === 0) {
|
if (rows.length === 0) {
|
||||||
global.nativeLoggingHook('');
|
global.nativeLoggingHook('', LOG_LEVELS.log);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,14 +130,15 @@
|
||||||
// Native logging hook adds "RCTLog >" at the front of every
|
// Native logging hook adds "RCTLog >" at the front of every
|
||||||
// logged string, which would shift the header and screw up
|
// logged string, which would shift the header and screw up
|
||||||
// the table
|
// the table
|
||||||
global.nativeLoggingHook('\n' + table.join('\n'));
|
global.nativeLoggingHook('\n' + table.join('\n'), LOG_LEVELS.log);
|
||||||
}
|
}
|
||||||
|
|
||||||
global.console = {
|
global.console = {
|
||||||
error: doNativeLog,
|
error: getNativeLogFunction(LOG_LEVELS.error),
|
||||||
info: doNativeLog,
|
info: getNativeLogFunction(LOG_LEVELS.info),
|
||||||
log: doNativeLog,
|
log: getNativeLogFunction(LOG_LEVELS.log),
|
||||||
warn: doNativeLog,
|
warn: getNativeLogFunction(LOG_LEVELS.warn),
|
||||||
|
trace: getNativeLogFunction(LOG_LEVELS.trace),
|
||||||
table: consoleTablePolyfill
|
table: consoleTablePolyfill
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue