smartlog-destination-local/dist/beautylog.console.js
2017-03-11 12:30:18 +01:00

42 lines
2.8 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVhdXR5bG9nLmNvbnNvbGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9iZWF1dHlsb2cuY29uc29sZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDBCQUF1QjtBQUV2QixtRUFBOEQ7QUFDOUQsSUFBSSxTQUFTLEdBQUcsT0FBTyxDQUFDLEdBQUcsQ0FBQTtBQUMzQixJQUFJLFdBQVcsR0FBRyxPQUFPLENBQUMsS0FBSyxDQUFBO0FBRS9COztHQUVHO0FBQ0gsSUFBSSxLQUFLLEdBQUcsVUFBUyxTQUFrQjtJQUNuQyxFQUFFLENBQUMsQ0FBQyxTQUFTLEtBQUssSUFBSSxDQUFDLENBQUMsQ0FBQztRQUNyQixPQUFPLENBQUMsR0FBRyxHQUFHLHFCQUFhLENBQUMsR0FBRyxDQUFBO1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