2016-05-19 17:27:09 +00:00
|
|
|
"use strict";
|
2016-05-23 07:10:30 +00:00
|
|
|
require("typings-global");
|
2016-07-23 17:47:23 +00:00
|
|
|
const beautylog_classes_ora_1 = require("./beautylog.classes.ora");
|
|
|
|
let nativeLog = console.log;
|
|
|
|
let nativeError = console.error;
|
2016-05-19 17:27:09 +00:00
|
|
|
/**
|
|
|
|
* routes the console to got through beautylog, so beautylog can take action before things are logged to console.
|
|
|
|
*/
|
2016-07-23 17:47:23 +00:00
|
|
|
let route = function (statusArg) {
|
2017-01-21 00:05:28 +00:00
|
|
|
if (statusArg === true) {
|
2016-05-19 17:27:09 +00:00
|
|
|
console.log = exports.beautyConsole.log;
|
2016-07-23 17:47:23 +00:00
|
|
|
console.error = exports.beautyConsole.error;
|
2016-05-19 17:27:09 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
console.log = nativeLog;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
exports.beautyConsole = {
|
|
|
|
log: function (logArg) {
|
|
|
|
if (beautylog_classes_ora_1.oraActive) {
|
|
|
|
beautylog_classes_ora_1.activeOra.pause();
|
|
|
|
nativeLog.apply(nativeLog, arguments);
|
|
|
|
beautylog_classes_ora_1.activeOra.start();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
nativeLog.apply(nativeLog, arguments);
|
|
|
|
}
|
2016-07-23 17:47:23 +00:00
|
|
|
},
|
|
|
|
error: function () {
|
|
|
|
if (beautylog_classes_ora_1.oraActive) {
|
|
|
|
beautylog_classes_ora_1.activeOra.pause();
|
|
|
|
nativeLog.apply(nativeError, arguments);
|
|
|
|
beautylog_classes_ora_1.activeOra.start();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
nativeLog.apply(nativeError, arguments);
|
|
|
|
}
|
2016-05-19 17:27:09 +00:00
|
|
|
}
|
|
|
|
};
|
2016-05-19 17:45:31 +00:00
|
|
|
route(true);
|
2017-01-21 00:05:28 +00:00
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ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