smartlog-destination-local/dist/beautylog.console.js

41 lines
2.8 KiB
JavaScript

"use strict";
require("typings-global");
const beautylog_classes_ora_1 = require("./beautylog.classes.ora");
let nativeLog = console.log;
let nativeError = console.error;
/**
* routes the console to got through beautylog, so beautylog can take action before things are logged to console.
*/
let route = function (statusArg) {
if (statusArg == true) {
console.log = exports.beautyConsole.log;
console.error = exports.beautyConsole.error;
}
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);
}
},
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);
}
}
};
route(true);
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVhdXR5bG9nLmNvbnNvbGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9iZWF1dHlsb2cuY29uc29sZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBRXhCLHdDQUFrQyx5QkFBeUIsQ0FBQyxDQUFBO0FBQzVELElBQUksU0FBUyxHQUFHLE9BQU8sQ0FBQyxHQUFHLENBQUM7QUFDNUIsSUFBSSxXQUFXLEdBQUcsT0FBTyxDQUFDLEtBQUssQ0FBQztBQUVoQzs7R0FFRztBQUNILElBQUksS0FBSyxHQUFHLFVBQVMsU0FBaUI7SUFDbEMsRUFBRSxDQUFBLENBQUMsU0FBUyxJQUFJLElBQUksQ0FBQyxDQUFBLENBQUM7UUFDbEIsT0FBTyxDQUFDLEdBQUcsR0FBRyxxQkFBYSxDQUFDLEdBQUcsQ0FBQztR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