8000 Merge pull request #611 from log4js-node/update-dev-dependencies · wxqGitHub/log4js-node@974d8ea · GitHub
[go: up one dir, main page]

Skip to content
10000

Commit 974d8ea

Browse files
authored
Merge pull request log4js-node#611 from log4js-node/update-dev-dependencies
chore: upgraded dev deps
2 parents 6c78f23 + 0e13be9 commit 974d8ea

File tree

12 files changed

+4046
-2743
lines changed

12 files changed

+4046
-2743
lines changed

.eslintrc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@
1212
"strict": 0,
1313
"import/no-extraneous-dependencies": 1,
1414
"prefer-spread": 0,
15-
"prefer-rest-params": 0
15+
"prefer-rest-params": 0,
16+
"prefer-destructuring": 0
1617
},
17-
"parser-options": {
18+
"parserOptions": {
1819
"ecmaVersion": 6
1920
}
2021
}

lib/appenders/file.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ function fileAppender(file, layout, logSize, numBackups, options, timezoneOffset
4040
// there has to be at least one backup if logSize has been specified
4141
numBackups = numBackups === 0 ? 1 : numBackups;
4242

43-
debug('Creating file appender (',
43+
debug(
44+
'Creating file appender (',
4445
file, ', ',
4546
logSize, ', ',
4647
numBackups, ', ',

lib/appenders/gelf.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ const OS = require('os');
88
const debug = require('debug')('log4js:gelf');
99

1010
/* eslint no-unused-vars:0 */
11-
const LOG_EMERG = 0; // system is unusable(unused)
12-
const LOG_ALERT = 1; // action must be taken immediately(unused)
13-
const LOG_CRIT = 2; // critical conditions
14-
const LOG_ERROR = 3; // error conditions
15-
const LOG_WARNING = 4; // warning conditions
16-
const LOG_NOTICE = 5; // normal, but significant, condition(unused)
17-
const LOG_INFO = 6; // informational message
18-
const LOG_DEBUG = 7; // debug-level message
11+
const LOG_EMERG = 0; // system is unusable(unused)
12+
const LOG_ALERT = 1; // action must be taken immediately(unused)
13+
const LOG_CRIT = 2; // critical conditions
14+
const LOG_ERROR = 3; // error conditions
15+
const LOG_WARNING = 4; // warning conditions
16+
const LOG_NOTICE = 5; // normal, but significant, condition(unused)
17+
const LOG_INFO = 6; // informational message
18+
const LOG_DEBUG = 7; // debug-level message
1919

2020
/**
2121
* GELF appender that supports sending UDP packets to a GELF compatible server such as Graylog
@@ -113,7 +113,7 @@ function gelfAppender(layout, config, levels) {
113113

114114
const app = (loggingEvent) => {
115115
const message = preparePacket(loggingEvent);
116-
zlib.gzip(new Buffer(JSON.stringify(message)), (err, packet) => {
116+
zlib.gzip(Buffer.from(JSON.stringify(message)), (err, packet) => {
117117
if (err) {
118118
console.error(err.stack);
119119
} else {

lib/appenders/logFaces-HTTP.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ function logFacesAppender(config) {
3636
return function log(event) {
3737
// convert to logFaces compact json format
3838
const lfsEvent = {
39-
a: config.application || '', // application name
40-
t: event.startTime.getTime(), // time stamp
41-
p: event.level.levelStr, // level (priority)
42-
g: event.categoryName, // logger name
43-
m: format(event.data) // message text
39+
a: config.application || '', // application name
40+
t: event.startTime.getTime(), // time stamp
41+
p: event.level.levelStr, // level (priority)
42+
g: event.categoryName, // logger name
43+
m: format(event.data) // message text
4444
};
4545

4646
// add context variables if exist
@@ -52,9 +52,7 @@ function logFacesAppender(config) {
5252
sender.post('', lfsEvent)
5353
.catch((error) => {
5454
if (error.response) {
55-
console.error(
56-
`log4js.logFaces-HTTP Appender error posting to ${config.url}: ${error.response.status} - ${error.response.data}`
57-
);
55+
console.error(`log4js.logFaces-HTTP Appender error posting to ${config.url}: ${error.response.status} - ${error.response.data}`);
5856
return;
5957
}
6058
console.error(`log4js.logFaces-HTTP Appender error: ${error.message}`);
@@ -67,8 +65,9 @@ function configure(config) {
6765
}
6866

6967
function format(logData) {
70-
const data = Array.isArray(logData) ?
71-
logData : Array.prototype.slice.call(arguments);
68+
const data = Array.isArray(logData)
69+
? logData
70+
: Array.prototype.slice.call(arguments);
7271
return util.format.apply(util, wrapErrorsWithInspect(data));
7372
}
7473

lib/appenders/logFaces-UDP.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function datagram(config) {
2121
const port = config.port || 55201;
2222

2323
return function (event) {
24-
const buff = new Buffer(JSON.stringify(event));
24+
const buff = Buffer.from(JSON.stringify(event));
2525
sock.send(buff, 0, buff.length, port, host, (err) => {
2626
if (err) {
2727
console.error(`log4js.logFacesUDPAppender error sending to ${host}:${port}, error: `, err);
@@ -46,11 +46,11 @@ function logFacesUDPAppender(config) {
4646
return function log(event) {
4747
// convert to logFaces compact json format
4848
const lfsEvent = {
49-
a: config.application || '', // application name
50-
t: event.startTime.getTime(), // time stamp
51-
p: event.level.levelStr, // level (priority)
52-
g: event.categoryName, // logger name
53-
m: format(event.data) // message text
49+
a: config.application || '', // application name
50+
t: event.startTime.getTime(), // time stamp
51+
p: event.level.levelStr, // level (priority)
52+
g: event.categoryName, // logger name
53+
m: format(event.data) // message text
5454
};
5555

5656
// add context variables if exist
@@ -82,8 +82,9 @@ function wrapErrorsWithInspect(items) {
8282
}
8383

8484
function format(logData) {
85-
const data = Array.isArray(logData) ?
86-
logData : Array.prototype.slice.call(arguments);
85+
const data = Array.isArray(logData)
86+
? logData
87+
: Array.prototype.slice.call(arguments);
8788
return util.format.apply(util, wrapErrorsWithInspect(data));
8889
}
8990

lib/appenders/logstashUDP.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const dgram = require('dgram');
44
const util = require('util');
55

66
function sendLog(udp, host, port, logObject) {
7-
const buffer = new Buffer(JSON.stringify(logObject));
7+
const buffer = Buffer.from(JSON.stringify(logObject));
88

99
/* eslint no-unused-vars:0 */
1010
udp.send(buffer, 0, buffer.length, port, host, (err, bytes) => {

lib/appenders/smtp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ function smtpAppender(config, layout, subjectLayout) {
113113
}
114114

115115
const appender = (loggingEvent) => {
116-
unsentCount++; // eslint-disable-line no-plusplus
116+
unsentCount++; // eslint-disable-line no-plusplus
117117
logEventBuffer.push(loggingEvent);
118118
if (sendInterval > 0) {
119119
scheduleSend();

0 commit comments

Comments
 (0)
0