fix logger.js

This commit is contained in:
Karsten Hassel 2021-09-09 23:30:36 +02:00
parent 53c789bff9
commit d7c70dc021

View File

@ -22,34 +22,21 @@
root.Log = factory(root.config); root.Log = factory(root.config);
} }
})(this, function (config) { })(this, function (config) {
let logLevel; let logLevel = {
if (process.env.JEST_WORKER_ID === undefined) { debug: Function.prototype.bind.call(console.debug, console),
logLevel = { log: Function.prototype.bind.call(console.log, console),
debug: Function.prototype.bind.call(console.debug, console), info: Function.prototype.bind.call(console.info, console),
log: Function.prototype.bind.call(console.log, console), warn: Function.prototype.bind.call(console.warn, console),
info: Function.prototype.bind.call(console.info, console), error: Function.prototype.bind.call(console.error, console),
warn: Function.prototype.bind.call(console.warn, console), group: Function.prototype.bind.call(console.group, console),
error: Function.prototype.bind.call(console.error, console), groupCollapsed: Function.prototype.bind.call(console.groupCollapsed, console),
group: Function.prototype.bind.call(console.group, console), groupEnd: Function.prototype.bind.call(console.groupEnd, console),
groupCollapsed: Function.prototype.bind.call(console.groupCollapsed, console), time: Function.prototype.bind.call(console.time, console),
groupEnd: Function.prototype.bind.call(console.groupEnd, console), timeEnd: Function.prototype.bind.call(console.timeEnd, console)
time: Function.prototype.bind.call(console.time, console), };
timeEnd: Function.prototype.bind.call(console.timeEnd, console),
timeStamp: Function.prototype.bind.call(console.timeStamp, console) if ((typeof exports === "object" && process.env.JEST_WORKER_ID === undefined) || typeof exports !== "object") {
}; logLevel.timeStamp = Function.prototype.bind.call(console.timeStamp, console);
} else {
logLevel = {
debug: Function.prototype.bind.call(console.debug, console),
log: Function.prototype.bind.call(console.log, console),
info: Function.prototype.bind.call(console.info, console),
warn: Function.prototype.bind.call(console.warn, console),
error: Function.prototype.bind.call(console.error, console),
group: Function.prototype.bind.call(console.group, console),
groupCollapsed: Function.prototype.bind.call(console.groupCollapsed, console),
groupEnd: Function.prototype.bind.call(console.groupEnd, console),
time: Function.prototype.bind.call(console.time, console),
timeEnd: Function.prototype.bind.call(console.timeEnd, console)
};
} }
logLevel.setLogLevel = function (newLevel) { logLevel.setLogLevel = function (newLevel) {