Merge pull request #611 from log4js-node/update-dev-dependencies

chore: upgraded dev deps
This commit is contained in:
Gareth Jones 2017-11-13 13:40:59 +11:00 committed by GitHub
commit 974d8ea3f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 4044 additions and 2741 deletions

View File

@ -12,9 +12,10 @@
"strict": 0,
"import/no-extraneous-dependencies": 1,
"prefer-spread": 0,
"prefer-rest-params": 0
"prefer-rest-params": 0,
"prefer-destructuring": 0
},
"parser-options": {
"parserOptions": {
"ecmaVersion": 6
}
}

View File

@ -40,7 +40,8 @@ function fileAppender(file, layout, logSize, numBackups, options, timezoneOffset
// there has to be at least one backup if logSize has been specified
numBackups = numBackups === 0 ? 1 : numBackups;
debug('Creating file appender (',
debug(
'Creating file appender (',
file, ', ',
logSize, ', ',
numBackups, ', ',

View File

@ -8,14 +8,14 @@ const OS = require('os');
const debug = require('debug')('log4js:gelf');
/* eslint no-unused-vars:0 */
const LOG_EMERG = 0; // system is unusable(unused)
const LOG_ALERT = 1; // action must be taken immediately(unused)
const LOG_CRIT = 2; // critical conditions
const LOG_ERROR = 3; // error conditions
const LOG_WARNING = 4; // warning conditions
const LOG_NOTICE = 5; // normal, but significant, condition(unused)
const LOG_INFO = 6; // informational message
const LOG_DEBUG = 7; // debug-level message
const LOG_EMERG = 0; // system is unusable(unused)
const LOG_ALERT = 1; // action must be taken immediately(unused)
const LOG_CRIT = 2; // critical conditions
const LOG_ERROR = 3; // error conditions
const LOG_WARNING = 4; // warning conditions
const LOG_NOTICE = 5; // normal, but significant, condition(unused)
const LOG_INFO = 6; // informational message
const LOG_DEBUG = 7; // debug-level message
/**
* GELF appender that supports sending UDP packets to a GELF compatible server such as Graylog
@ -113,7 +113,7 @@ function gelfAppender(layout, config, levels) {
const app = (loggingEvent) => {
const message = preparePacket(loggingEvent);
zlib.gzip(new Buffer(JSON.stringify(message)), (err, packet) => {
zlib.gzip(Buffer.from(JSON.stringify(message)), (err, packet) => {
if (err) {
console.error(err.stack);
} else {

View File

@ -36,11 +36,11 @@ function logFacesAppender(config) {
return function log(event) {
// convert to logFaces compact json format
const lfsEvent = {
a: config.application || '', // application name
t: event.startTime.getTime(), // time stamp
p: event.level.levelStr, // level (priority)
g: event.categoryName, // logger name
m: format(event.data) // message text
a: config.application || '', // application name
t: event.startTime.getTime(), // time stamp
p: event.level.levelStr, // level (priority)
g: event.categoryName, // logger name
m: format(event.data) // message text
};
// add context variables if exist
@ -52,9 +52,7 @@ function logFacesAppender(config) {
sender.post('', lfsEvent)
.catch((error) => {
if (error.response) {
console.error(
`log4js.logFaces-HTTP Appender error posting to ${config.url}: ${error.response.status} - ${error.response.data}`
);
console.error(`log4js.logFaces-HTTP Appender error posting to ${config.url}: ${error.response.status} - ${error.response.data}`);
return;
}
console.error(`log4js.logFaces-HTTP Appender error: ${error.message}`);
@ -67,8 +65,9 @@ function configure(config) {
}
function format(logData) {
const data = Array.isArray(logData) ?
logData : Array.prototype.slice.call(arguments);
const data = Array.isArray(logData)
? logData
: Array.prototype.slice.call(arguments);
return util.format.apply(util, wrapErrorsWithInspect(data));
}

View File

@ -21,7 +21,7 @@ function datagram(config) {
const port = config.port || 55201;
return function (event) {
const buff = new Buffer(JSON.stringify(event));
const buff = Buffer.from(JSON.stringify(event));
sock.send(buff, 0, buff.length, port, host, (err) => {
if (err) {
console.error(`log4js.logFacesUDPAppender error sending to ${host}:${port}, error: `, err);
@ -46,11 +46,11 @@ function logFacesUDPAppender(config) {
return function log(event) {
// convert to logFaces compact json format
const lfsEvent = {
a: config.application || '', // application name
t: event.startTime.getTime(), // time stamp
p: event.level.levelStr, // level (priority)
g: event.categoryName, // logger name
m: format(event.data) // message text
a: config.application || '', // application name
t: event.startTime.getTime(), // time stamp
p: event.level.levelStr, // level (priority)
g: event.categoryName, // logger name
m: format(event.data) // message text
};
// add context variables if exist
@ -82,8 +82,9 @@ function wrapErrorsWithInspect(items) {
}
function format(logData) {
const data = Array.isArray(logData) ?
logData : Array.prototype.slice.call(arguments);
const data = Array.isArray(logData)
? logData
: Array.prototype.slice.call(arguments);
return util.format.apply(util, wrapErrorsWithInspect(data));
}

View File

@ -4,7 +4,7 @@ const dgram = require('dgram');
const util = require('util');
function sendLog(udp, host, port, logObject) {
const buffer = new Buffer(JSON.stringify(logObject));
const buffer = Buffer.from(JSON.stringify(logObject));
/* eslint no-unused-vars:0 */
udp.send(buffer, 0, buffer.length, port, host, (err, bytes) => {

View File

@ -113,7 +113,7 @@ function smtpAppender(config, layout, subjectLayout) {
}
const appender = (loggingEvent) => {
unsentCount++; // eslint-disable-line no-plusplus
unsentCount++; // eslint-disable-line no-plusplus
logEventBuffer.push(loggingEvent);
if (sendInterval > 0) {
scheduleSend();

6691
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -45,17 +45,17 @@
"streamroller": "^0.6.0"
},
"devDependencies": {
"codecov": "^1.0.1",
"conventional-changelog": "^1.1.4",
"eslint": "^3.19.0",
"eslint-config-airbnb-base": "^11.2.0",
"codecov": "^3.0.0",
"conventional-changelog": "^1.1.6",
"eslint": "^4.10.0",
"eslint-config-airbnb-base": "^12.1.0",
"eslint-import-resolver-node": "^0.3.1",
"eslint-plugin-import": "^2.6.1",
"husky": "^0.12.0",
"nyc": "^10.3.2",
"eslint-plugin-import": "^2.8.0",
"husky": "^0.14.3",
"nyc": "^11.3.0",
"sandboxed-module": "^2.0.3",
"tap": "^8.0.1",
"validate-commit-msg": "^2.12.2"
"tap": "^10.7.3",
"validate-commit-msg": "^2.14.0"
},
"optionalDependencies": {
"hipchat-notifier": "^1.1.0",

View File

@ -104,7 +104,7 @@ test('log4js layouts', (batch) => {
}
}
}),
/at Object\.<anonymous>\s+\((.*)test[\\/]tap[\\/]layouts-test\.js:\d+:\d+\)/,
/at (Test.batch.test|Test.<anonymous>)\s+\((.*)test[\\/]tap[\\/]layouts-test\.js:\d+:\d+\)/,
'regexp did not return a match - should print the stacks of a passed error objects'
);

View File

@ -29,9 +29,9 @@ test('multiprocess appender shutdown (master)', { timeout: 2000 }, (t) => {
t.ok(err, 'we got a connection error');
t.end();
});
}, 500);
}, 250);
});
}, 500);
}, 250);
});
test('multiprocess appender shutdown (worker)', (t) => {

View File

@ -76,12 +76,12 @@ if (cluster.isMaster) {
});
const anotherLogger = log4js.getLogger('test');
anotherLogger.info('this should now get logged');
}, 1000);
}, 500);
// we have to wait a bit, so that the process.send messages get a chance to propagate
setTimeout(() => {
const events = recorder.replay();
process.send({ type: 'testing', instance: process.env.NODE_APP_INSTANCE, events: events });
cluster.worker.disconnect();
}, 2000);
}, 2500);
}