Skip to content

Commit

Permalink
chore: upgraded dev deps
Browse files Browse the repository at this point in the history
  • Loading branch information
Rami Cohen committed Nov 13, 2017
1 parent 6c78f23 commit 0e13be9
Show file tree
Hide file tree
Showing 12 changed files with 4,046 additions and 2,743 deletions.
5 changes: 3 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
3 changes: 2 additions & 1 deletion lib/appenders/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, ', ',
Expand Down
18 changes: 9 additions & 9 deletions lib/appenders/gelf.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
19 changes: 9 additions & 10 deletions lib/appenders/logFaces-HTTP.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}`);
Expand All @@ -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));
}

Expand Down
17 changes: 9 additions & 8 deletions lib/appenders/logFaces-UDP.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down Expand Up @@ -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));
}

Expand Down
2 changes: 1 addition & 1 deletion lib/appenders/logstashUDP.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion lib/appenders/smtp.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Loading

0 comments on commit 0e13be9

Please sign in to comment.