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

30 lines
3.0 KiB
JavaScript

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