mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-02-17 09:46:37 +00:00
move intercept logs to utils
This commit is contained in:
parent
1e7f0ada5b
commit
ac4b74588e
@ -494,6 +494,31 @@ function timer(ms) {
|
|||||||
return new Promise(resolve => setTimeout(resolve, ms));
|
return new Promise(resolve => setTimeout(resolve, ms));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function interceptLogs(consoleContext, logger) {
|
||||||
|
let context = {};
|
||||||
|
context.console = consoleContext;
|
||||||
|
|
||||||
|
context.console.log = function() {
|
||||||
|
logger.info(normalizeInput(arguments));
|
||||||
|
};
|
||||||
|
context.console.warn = function() {
|
||||||
|
logger.warn(normalizeInput(arguments));
|
||||||
|
};
|
||||||
|
context.console.info = function() {
|
||||||
|
logger.info(normalizeInput(arguments));
|
||||||
|
};
|
||||||
|
context.console.debug = function() {
|
||||||
|
// TODO: ue JSON.stringify
|
||||||
|
logger.debug(normalizeInput(arguments));
|
||||||
|
};
|
||||||
|
context.console.trace = function() {
|
||||||
|
logger.trace(normalizeInput(arguments));
|
||||||
|
};
|
||||||
|
context.console.dir = function() {
|
||||||
|
logger.dir(normalizeInput(arguments));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
joinPath,
|
joinPath,
|
||||||
dirname,
|
dirname,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user