Commit 42e25bf5 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch 'merge-node-changes' into 'master'

Merge node changes

See merge request !764
parents e2f54f69 0b92ac49
Pipeline #10026 passed with stage
in 8 minutes and 54 seconds
......@@ -754,6 +754,12 @@
"safe-buffer": "^5.0.1"
}
},
"circular-json": {
"version": "0.5.9",
"resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.5.9.tgz",
"integrity": "sha512-4ivwqHpIFJZBuhN3g/pEcdbnGUywkBblloGbkglyloVjjR3uT6tieI89MVOfbP2tHX5sgb01FuLgAOzebNlJNQ==",
"dev": true
},
"clean-css": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/clean-css/-/clean-css-4.2.1.tgz",
......@@ -1214,6 +1220,11 @@
"jquery": ">=1.7"
}
},
"date-format": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/date-format/-/date-format-2.0.0.tgz",
"integrity": "sha512-M6UqVvZVgFYqZL1SfHsRGIQSz3ZL+qgbsV5Lp1Vj61LZVYuEwcMXYay7DRDtYs2HQQBK5hQtQ0fD9aEJ89V0LA=="
},
"date-now": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz",
......@@ -1899,6 +1910,11 @@
"repeat-string": "^1.5.2"
}
},
"flatted": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.0.tgz",
"integrity": "sha512-R+H8IZclI8AAkSBRQJLVOsxwAoHd6WC40b4QTNWIjzAa6BXOBfQcM587MXDTVPeYaopFNWHUFLx7eNmHDSxMWg=="
},
"for-in": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz",
......@@ -3208,12 +3224,87 @@
"dev": true
},
"log4js": {
"version": "0.6.38",
"resolved": "https://registry.npmjs.org/log4js/-/log4js-0.6.38.tgz",
"integrity": "sha1-LElBFmldb7JUgJQ9P8hy5mKlIv0=",
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/log4js/-/log4js-4.1.0.tgz",
"integrity": "sha512-eDa+zZPeVEeK6QGJAePyXM6pg4P3n3TO5rX9iZMVY48JshsTyLJZLIL5HipI1kQ2qLsSyOpUqNND/C5H4WhhiA==",
"requires": {
"date-format": "^2.0.0",
"debug": "^4.1.1",
"flatted": "^2.0.0",
"rfdc": "^1.1.2",
"streamroller": "^1.0.4"
},
"dependencies": {
"debug": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
"requires": {
"ms": "^2.1.1"
}
},
"ms": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
"integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg=="
}
}
},
"log4js-in-memory-appender": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/log4js-in-memory-appender/-/log4js-in-memory-appender-0.1.2.tgz",
"integrity": "sha512-XjpB6BZJtIPL0AQ6MfJ5vVUtCqJnztbLEblMMn2IvstI7RWMBGDffyj4v+iPcBiNpn4IooM94rl6+UzbQVthvA==",
"dev": true,
"requires": {
"readable-stream": "~1.0.2",
"semver": "~4.3.3"
"log4js": "^3.0.6"
},
"dependencies": {
"date-format": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/date-format/-/date-format-1.2.0.tgz",
"integrity": "sha1-YV6CjiM90aubua4JUODOzPpuytg=",
"dev": true
},
"debug": {
"version": "3.2.6",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
"integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
"dev": true,
"requires": {
"ms": "^2.1.1"
}
},
"log4js": {
"version": "3.0.6",
"resolved": "https://registry.npmjs.org/log4js/-/log4js-3.0.6.tgz",
"integrity": "sha512-ezXZk6oPJCWL483zj64pNkMuY/NcRX5MPiB0zE6tjZM137aeusrOnW1ecxgF9cmwMWkBMhjteQxBPoZBh9FDxQ==",
"dev": true,
"requires": {
"circular-json": "^0.5.5",
"date-format": "^1.2.0",
"debug": "^3.1.0",
"rfdc": "^1.1.2",
"streamroller": "0.7.0"
}
},
"ms": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
"integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==",
"dev": true
},
"streamroller": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/streamroller/-/streamroller-0.7.0.tgz",
"integrity": "sha512-WREzfy0r0zUqp3lGO096wRuUp7ho1X6uo/7DJfTlEi0Iv/4gT7YHqXDjKC2ioVGBZtE8QzsQD9nx1nIuoZ57jQ==",
"dev": true,
"requires": {
"date-format": "^1.2.0",
"debug": "^3.1.0",
"mkdirp": "^0.5.1",
"readable-stream": "^2.3.0"
}
}
}
},
"log4js-memory-appender": {
......@@ -4191,14 +4282,41 @@
}
},
"readable-stream": {
"version": "1.0.34",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz",
"integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=",
"version": "2.3.6",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
"integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
"dev": true,
"requires": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.1",
"isarray": "0.0.1",
"string_decoder": "~0.10.x"
"inherits": "~2.0.3",
"isarray": "~1.0.0",
"process-nextick-args": "~2.0.0",
"safe-buffer": "~5.1.1",
"string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1"
},
"dependencies": {
"isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
"dev": true
},
"process-nextick-args": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz",
"integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==",
"dev": true
},
"string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"dev": true,
"requires": {
"safe-buffer": "~5.1.0"
}
}
}
},
"recast": {
......@@ -4459,6 +4577,11 @@
"resolved": "https://registry.npmjs.org/retry/-/retry-0.10.1.tgz",
"integrity": "sha1-52OI0heZLCUnUCQdPTlW/tmNj/Q="
},
"rfdc": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.1.2.tgz",
"integrity": "sha512-92ktAgvZhBzYTIK0Mja9uen5q5J3NRVMoDkJL2VMwq6SXjVCgqvQeVP2XAaUY6HT+XpQYeLSjb3UoitBryKmdA=="
},
"right-align": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz",
......@@ -4561,11 +4684,6 @@
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==",
"dev": true
},
"semver": {
"version": "4.3.6",
"resolved": "https://registry.npmjs.org/semver/-/semver-4.3.6.tgz",
"integrity": "sha1-MAvG4OhjdPe6YQaLWx7NV/xlMto="
},
"send": {
"version": "0.16.1",
"resolved": "https://registry.npmjs.org/send/-/send-0.16.1.tgz",
......@@ -4969,6 +5087,56 @@
"once": "^1.3.3"
}
},
"streamroller": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/streamroller/-/streamroller-1.0.4.tgz",
"integrity": "sha512-Wc2Gm5ygjSX8ZpW9J7Y9FwiSzTlKSvcl0FTTMd3rn7RoxDXpBW+xD9TY5sWL2n0UR61COB0LG1BQvN6nTUQbLQ==",
"requires": {
"async": "^2.6.1",
"date-format": "^2.0.0",
"debug": "^3.1.0",
"fs-extra": "^7.0.0",
"lodash": "^4.17.10"
},
"dependencies": {
"async": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/async/-/async-2.6.2.tgz",
"integrity": "sha512-H1qVYh1MYhEEFLsP97cVKqCGo7KfCyTt6uEWqsTBr9SO84oK9Uwbyd/yCW+6rKJLHksBNUVWZDAjfS+Ccx0Bbg==",
"requires": {
"lodash": "^4.17.11"
}
},
"debug": {
"version": "3.2.6",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
"integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
"requires": {
"ms": "^2.1.1"
}
},
"fs-extra": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz",
"integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==",
"requires": {
"graceful-fs": "^4.1.2",
"jsonfile": "^4.0.0",
"universalify": "^0.1.0"
}
},
"lodash": {
"version": "4.17.11",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz",
"integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg=="
},
"ms": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
"integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg=="
}
}
},
"string-width": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
......
......@@ -33,7 +33,7 @@
"jquery-ui-dist": "1.12.1",
"jsdom": "11.7.0",
"jshint": "^2.9.6",
"log4js-memory-appender": "1.0.5",
"log4js-in-memory-appender": "^0.1.2",
"mkdirp": "^0.5.1",
"mocha": "^3.5.3",
"mock-local-storage": "^1.1.8",
......@@ -50,7 +50,7 @@
"is-url": "^1.2.4",
"jstree": "^3.3.5",
"jszip": "^3.1.5",
"log4js": "0.6.38",
"log4js": "4.1.0",
"multi-checkbox-list": "^0.3.1",
"openlayers": "^4.6.5",
"pileup": "^0.6.9",
......
......@@ -278,13 +278,13 @@ function initGlobals(params) {
if (global.ServerConnector === undefined) {
global.ServerConnector = ServerConnector;
if (params.isDebug()) {
logger.setLevel("debug");
logger.level="debug";
} else {
logger.setLevel("info");
logger.level="info";
}
GuiConnector.init();
if (GuiConnector.getParams['debug'] !== undefined) {
logger.setLevel("debug");
logger.level="debug";
}
} else {
logger.warn("global ServerConnector found");
......
"use strict";
require("./mocha-config");
var GuiConnector = require('../../main/js/GuiConnector');
var SecurityError = require('../../main/js/SecurityError');
var ServerConnector = require('./ServerConnector-mock');
var chai = require('chai');
var assert = chai.assert;
var logger = require('./logger');
describe('logger', function () {
beforeEach(function(){
logger.flushBuffer();
});
it('warn', function () {
logger.warn("test warning");
assert.equal(1, logger.getWarnings().length);
assert.equal(1, logger.getEvents().length);
});
it('debug', function () {
logger.debug("test debug");
assert.equal(1, logger.getEvents().length);
});
it('error', function () {
logger.error("test error");
assert.equal(1, logger.getErrors().length);
});
});
\ No newline at end of file
"use strict";
var log4js = require('log4js');
var inMemoryAppender = require('log4js-in-memory-appender');
var $depth = 10;
log4js.configure({
appenders : [ {
type : "console",
layout : {
type : "pattern",
pattern : "%[%p {%x{ln}} -%]\t%m",
tokens : {
ln : function() {
// The caller:
var filePath = (new Error()).stack.split("\n")[$depth].split("\\");
filePath = filePath[filePath.length - 1].split("/");
return filePath[filePath.length - 1];
appenders: {
consoleAppender: {
type: "console",
layout: {
type: "pattern",
pattern: "%[%p {%x{ln}} -%]\t%m",
tokens: {
ln: function () {
// The caller:
var filePath = (new Error()).stack.split("\n")[$depth].split("\\");
filePath = filePath[filePath.length - 1].split("/");
return filePath[filePath.length - 1];
}
}
}
},
memoryAppender: {
type: 'log4js-in-memory-appender',
maxBufferSize: 100 // Optional default 100
}
} ]
});
var appender = require('log4js-memory-appender');
var memAppender = appender({
maxBufferSize : 1000
},
categories: {
default: {appenders: ['memoryAppender', 'consoleAppender'], level: 'debug'}
}
});
log4js.loadAppender('memory', memAppender);
log4js.addAppender(log4js.appenders.memory());
var logger = log4js.getLogger();
logger.getEvents = function() {
return memAppender.getBuffer();
logger.getEvents = function () {
return inMemoryAppender.buffer.default;
};
logger.getErrors = function() {
logger.getErrors = function () {
var result = [];
for (var i = 0; i < memAppender.getBuffer().length; i++) {
var message = memAppender.getBuffer()[i];
if (message.indexOf("[ERROR]") !== -1) {
var buffer = inMemoryAppender.buffer.default;
for (var i = 0; i < buffer.length; i++) {
var message = buffer[i];
if (message.indexOf("'ERROR'") !== -1) {
result.push(message);
}
}
return result;
};
logger.getWarnings = function() {
logger.getWarnings = function () {
var result = [];
for (var i = 0; i < memAppender.getBuffer().length; i++) {
var message = memAppender.getBuffer()[i];
if (message.indexOf("[WARN]") !== -1) {
var buffer = inMemoryAppender.buffer.default;
for (var i = 0; i < buffer.length; i++) {
var message = buffer[i];
if (message.indexOf("'WARN'") !== -1) {
result.push(message);
}
}
return result;
};
logger.flushBuffer = function() {
return memAppender.flushBuffer();
logger.flushBuffer = function () {
return inMemoryAppender.flush('default');
};
module.exports = logger;
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