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

32 lines
3.1 KiB
JavaScript
Raw Normal View History

2016-05-19 17:27:09 +00:00
"use strict";
2016-05-23 07:10:30 +00:00
require("typings-global");
2016-05-19 17:27:09 +00:00
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.
*/
2016-05-19 17:45:31 +00:00
var route = function (statusArg) {
2016-05-19 17:27:09 +00:00
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);
}
}
};
2016-05-19 17:45:31 +00:00
route(true);
2016-05-19 17:27:09 +00:00
2016-05-23 07:10:30 +00:00
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImJlYXV0eWxvZy5jb25zb2xlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFFeEIsc0NBQWtDLHlCQUF5QixDQUFDLENBQUE7QUFDNUQsSUFBSSxTQUFTLEdBQUcsT0FBTyxDQUFDLEdBQUcsQ0FBQztBQUU1Qjs7R0FFRztBQUNILElBQUksS0FBSyxHQUFHLFVBQVMsU0FBaUI7SUFDbEMsRUFBRSxDQUFBLENBQUMsU0FBUyxJQUFJLElBQUksQ0FBQyxDQUFBLENBQUM7UUFDbEIsT0FBTyxDQUFDLEdBQUcsR0FBRyxxQkFBYSxDQUFDLEdBQUcsQ0FBQztJQUNwQyxDQUFDO0lBQUMsSUFBSSxDQUFDLENBQUM7UUFDSixPQUFPLENBQUMsR0FBRyxHQUFHLFNBQVMsQ0FBQztJQUM1QixDQU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