Commit ed593917 authored by Piotr Gawron's avatar Piotr Gawron

Merge branch 'problem-with-logger' into 'devel_12.2.x'

fdue to problems with logger custom logging mechainsm is used

See merge request !766
parents ccf97090 cbb80185
Pipeline #10108 passed with stage
in 9 minutes and 19 seconds
......@@ -3307,12 +3307,6 @@
}
}
},
"log4js-memory-appender": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/log4js-memory-appender/-/log4js-memory-appender-1.0.5.tgz",
"integrity": "sha1-e4I2NDpCuLEgidjX+kebD22aNME=",
"dev": true
},
"longest": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz",
......
"use strict";
var log4js = require('log4js');
/**
* @typedef {Object} Logger
* @property {function(string):void} setLevel
* @property {function(Object):void} warn
* @property {function(Object):void} info
* @property {function(Object):void} debug
......@@ -15,6 +12,47 @@ var log4js = require('log4js');
/**
* @type Logger
*/
var logger = log4js.getLogger();
if (typeof global.it === 'function') {
var log4js = require('log4js');
logger = log4js.getLogger();
} else {
var logger = new function () {
var levels = ["DEBUG", "INFO", "WARN", "ERROR", "FATAL"];
var level = "DEBUG";
// noinspection JSUnusedGlobalSymbols
return {
checkLevel: function (minLevel) {
var index = levels.indexOf(level);
var minLevelIndex = levels.indexOf(minLevel);
return index <= minLevelIndex;
},
debug: function (message) {
if (this.checkLevel("DEBUG")) {
console.log(message)
}
},
info: function (message) {
if (this.checkLevel("INFO")) {
console.log(message)
}
},
warn: function (message) {
if (this.checkLevel("WARN")) {
console.log(message)
}
},
error: function (message) {
if (this.checkLevel("ERROR")) {
console.log(message)
}
},
fatal: function (message) {
if (this.checkLevel("FATAL")) {
console.log(message)
}
}
}
};
}
module.exports = logger;
......@@ -3,7 +3,7 @@
var log4js = require('log4js');
var inMemoryAppender = require('log4js-in-memory-appender');
var $depth = 10;
var $depth = 16;
log4js.configure({
appenders: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment