mirror of
https://github.com/log4js-node/log4js-node.git
synced 2025-12-08 19:26:01 +00:00
Merge pull request #1329 from log4js-node/update-deps
chore(deps-dev): updated dependencies
This commit is contained in:
commit
1895d3132f
@ -87,11 +87,11 @@
|
||||
|
||||
{% if site.google_analytics %}
|
||||
<script>
|
||||
(function(i, s, o, g, r, a, m) {
|
||||
(function (i, s, o, g, r, a, m) {
|
||||
i["GoogleAnalyticsObject"] = r;
|
||||
(i[r] =
|
||||
i[r] ||
|
||||
function() {
|
||||
function () {
|
||||
(i[r].q = i[r].q || []).push(arguments);
|
||||
}),
|
||||
(i[r].l = 1 * new Date());
|
||||
|
||||
@ -20,7 +20,7 @@ log4js.configure({
|
||||
var logger = log4js.getLogger("cheese");
|
||||
var app = express();
|
||||
app.use(log4js.connectLogger(logger, { level: "info" }));
|
||||
app.get("/", function(req, res) {
|
||||
app.get("/", function (req, res) {
|
||||
res.send("hello world");
|
||||
});
|
||||
app.listen(5000);
|
||||
|
||||
@ -165,7 +165,7 @@ log4js.configure({
|
||||
type: "pattern",
|
||||
pattern: "%d %p %c %x{user} %m%n",
|
||||
tokens: {
|
||||
user: function(logEvent) {
|
||||
user: function (logEvent) {
|
||||
return AuthLibrary.currentUser();
|
||||
},
|
||||
},
|
||||
@ -223,8 +223,8 @@ This example can also be found in examples/custom-layout.js.
|
||||
```javascript
|
||||
const log4js = require("log4js");
|
||||
|
||||
log4js.addLayout("json", function(config) {
|
||||
return function(logEvent) {
|
||||
log4js.addLayout("json", function (config) {
|
||||
return function (logEvent) {
|
||||
return JSON.stringify(logEvent) + config.separator;
|
||||
};
|
||||
});
|
||||
|
||||
@ -3,7 +3,7 @@ const log4js = require('../lib/log4js');
|
||||
log4js.addLayout(
|
||||
'json',
|
||||
(config) =>
|
||||
function(logEvent) {
|
||||
function (logEvent) {
|
||||
return JSON.stringify(logEvent) + config.separator;
|
||||
}
|
||||
);
|
||||
|
||||
@ -44,7 +44,7 @@ log4js.configure({
|
||||
hipchat_room: process.env.HIPCHAT_ROOM || '< Room ID or Name >',
|
||||
hipchat_from: 'Mr. Semantics',
|
||||
hipchat_notify: false,
|
||||
hipchat_response_callback: function(err, response, body) {
|
||||
hipchat_response_callback: function (err, response, body) {
|
||||
if (err || response.statusCode > 300) {
|
||||
throw new Error('hipchat-notifier failed');
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@ log4js.configure({
|
||||
type: 'pattern',
|
||||
pattern: '%[%r (%x{pid}) %p %c -%] %m%n',
|
||||
tokens: {
|
||||
pid: function() {
|
||||
pid: function () {
|
||||
return process.pid;
|
||||
},
|
||||
},
|
||||
|
||||
@ -35,7 +35,7 @@ function appender(filename, pattern, layout, options, timezoneOffset) {
|
||||
|
||||
const writer = openTheStream(filename, pattern, options);
|
||||
|
||||
const app = function(logEvent) {
|
||||
const app = function (logEvent) {
|
||||
if (!writer.writable) {
|
||||
return;
|
||||
}
|
||||
@ -44,7 +44,7 @@ function appender(filename, pattern, layout, options, timezoneOffset) {
|
||||
}
|
||||
};
|
||||
|
||||
app.shutdown = function(complete) {
|
||||
app.shutdown = function (complete) {
|
||||
writer.end('', 'utf-8', complete);
|
||||
};
|
||||
|
||||
|
||||
@ -83,7 +83,7 @@ function fileAppender(
|
||||
|
||||
let writer = openTheStream(file, logSize, numBackups, options);
|
||||
|
||||
const app = function(loggingEvent) {
|
||||
const app = function (loggingEvent) {
|
||||
if (!writer.writable) {
|
||||
return;
|
||||
}
|
||||
@ -100,18 +100,18 @@ function fileAppender(
|
||||
}
|
||||
};
|
||||
|
||||
app.reopen = function() {
|
||||
app.reopen = function () {
|
||||
writer.end(() => {
|
||||
writer = openTheStream(file, logSize, numBackups, options);
|
||||
});
|
||||
};
|
||||
|
||||
app.sighupHandler = function() {
|
||||
app.sighupHandler = function () {
|
||||
debug('SIGHUP handler called.');
|
||||
app.reopen();
|
||||
};
|
||||
|
||||
app.shutdown = function(complete) {
|
||||
app.shutdown = function (complete) {
|
||||
sighupListeners.delete(app);
|
||||
if (sighupListeners.size === 0 && mainSighupListenerStarted) {
|
||||
process.removeListener('SIGHUP', mainSighupHandler);
|
||||
|
||||
@ -78,7 +78,7 @@ function logServer(config, actualAppender, levels) {
|
||||
return actualAppender(event);
|
||||
}
|
||||
|
||||
app.shutdown = function(cb) {
|
||||
app.shutdown = function (cb) {
|
||||
debug('(master) master shutdown called, closing server');
|
||||
server.close(cb);
|
||||
};
|
||||
@ -108,8 +108,9 @@ function workerAppender(config) {
|
||||
|
||||
function createSocket() {
|
||||
debug(
|
||||
`(worker) worker appender creating socket to ${config.loggerHost ||
|
||||
'localhost'}:${config.loggerPort || 5000}`
|
||||
`(worker) worker appender creating socket to ${
|
||||
config.loggerHost || 'localhost'
|
||||
}:${config.loggerPort || 5000}`
|
||||
);
|
||||
socket = net.createConnection(
|
||||
config.loggerPort || 5000,
|
||||
@ -141,7 +142,7 @@ function workerAppender(config) {
|
||||
buffer.push(loggingEvent);
|
||||
}
|
||||
}
|
||||
log.shutdown = function(cb) {
|
||||
log.shutdown = function (cb) {
|
||||
debug('(worker) worker shutdown called');
|
||||
if (buffer.length && shutdownAttempts) {
|
||||
debug('(worker) worker buffer has items, waiting 100ms to empty');
|
||||
|
||||
@ -3,7 +3,7 @@ const debug = require('debug')('log4js:recording');
|
||||
const recordedEvents = [];
|
||||
|
||||
function configure() {
|
||||
return function(logEvent) {
|
||||
return function (logEvent) {
|
||||
debug(
|
||||
`received logEvent, number of events now ${recordedEvents.length + 1}`
|
||||
);
|
||||
|
||||
@ -23,8 +23,9 @@ function appender(config, layout) {
|
||||
|
||||
function createSocket() {
|
||||
debug(
|
||||
`appender creating socket to ${config.host ||
|
||||
'localhost'}:${config.port || 5000}`
|
||||
`appender creating socket to ${config.host || 'localhost'}:${
|
||||
config.port || 5000
|
||||
}`
|
||||
);
|
||||
endMsg = `${config.endMsg || '__LOG4JS__'}`;
|
||||
socket = net.createConnection(
|
||||
@ -61,7 +62,7 @@ function appender(config, layout) {
|
||||
}
|
||||
}
|
||||
|
||||
log.shutdown = function(cb) {
|
||||
log.shutdown = function (cb) {
|
||||
debug('shutdown called');
|
||||
if (buffer.length && shutdownAttempts) {
|
||||
debug('buffer has items, waiting 100ms to empty');
|
||||
@ -79,7 +80,7 @@ function appender(config, layout) {
|
||||
|
||||
function configure(config, layouts) {
|
||||
debug(`configure with config = ${config}`);
|
||||
let layout = function(loggingEvent) {
|
||||
let layout = function (loggingEvent) {
|
||||
return loggingEvent.serialise();
|
||||
};
|
||||
if (config.layout) {
|
||||
|
||||
@ -134,7 +134,8 @@ function dummyLayout(loggingEvent) {
|
||||
*/
|
||||
function patternLayout(pattern, tokens) {
|
||||
const TTCC_CONVERSION_PATTERN = '%r %p %c - %m%n';
|
||||
const regex = /%(-?[0-9]+)?(\.?-?[0-9]+)?([[\]cdhmnprzxXyflosCMAF%])(\{([^}]+)\})?|([^%]+)/;
|
||||
const regex =
|
||||
/%(-?[0-9]+)?(\.?-?[0-9]+)?([[\]cdhmnprzxXyflosCMAF%])(\{([^}]+)\})?|([^%]+)/;
|
||||
|
||||
pattern = pattern || TTCC_CONVERSION_PATTERN;
|
||||
|
||||
@ -275,7 +276,7 @@ function patternLayout(pattern, tokens) {
|
||||
|
||||
// support for ESM as it uses url instead of path for file
|
||||
/* istanbul ignore next: unsure how to simulate ESM for test coverage */
|
||||
const convertFileURLToPath = function(filepath) {
|
||||
const convertFileURLToPath = function (filepath) {
|
||||
const urlPrefix = 'file://';
|
||||
if (filepath.startsWith(urlPrefix)) {
|
||||
// https://nodejs.org/api/url.html#urlfileurltopathurl
|
||||
@ -409,7 +410,7 @@ function patternLayout(pattern, tokens) {
|
||||
return replacement;
|
||||
}
|
||||
|
||||
return function(loggingEvent) {
|
||||
return function (loggingEvent) {
|
||||
let formattedString = '';
|
||||
let result;
|
||||
let searchString = pattern;
|
||||
|
||||
@ -159,11 +159,11 @@ function addLevelMethods(target) {
|
||||
);
|
||||
const isLevelMethod = levelMethod[0].toUpperCase() + levelMethod.slice(1);
|
||||
|
||||
Logger.prototype[`is${isLevelMethod}Enabled`] = function() {
|
||||
Logger.prototype[`is${isLevelMethod}Enabled`] = function () {
|
||||
return this.isLevelEnabled(level);
|
||||
};
|
||||
|
||||
Logger.prototype[levelMethod] = function(...args) {
|
||||
Logger.prototype[levelMethod] = function (...args) {
|
||||
this.log(level, ...args);
|
||||
};
|
||||
}
|
||||
|
||||
2742
package-lock.json
generated
2742
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -62,14 +62,14 @@
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-import-resolver-node": "^0.3.6",
|
||||
"eslint-plugin-import": "^2.26.0",
|
||||
"eslint-plugin-prettier": "^3.4.1",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"fs-extra": "^10.1.0",
|
||||
"husky": "^8.0.1",
|
||||
"is-ci": "^3.0.1",
|
||||
"nyc": "^14.1.1",
|
||||
"prettier": "^1.19.1",
|
||||
"nyc": "^15.1.0",
|
||||
"prettier": "^2.7.1",
|
||||
"proxyquire": "^2.1.3",
|
||||
"tap": "^14.11.0",
|
||||
"tap": "^16.3.0",
|
||||
"typescript": "^4.8.3"
|
||||
},
|
||||
"browser": {
|
||||
|
||||
@ -6,8 +6,10 @@ sandbox.configure({
|
||||
if (this.filename.indexOf('node_modules') > -1) {
|
||||
return source;
|
||||
}
|
||||
const nyc = new (require('nyc'))();
|
||||
return nyc.instrumenter().instrumentSync(source, this.filename);
|
||||
const nyc = new (require('nyc'))({});
|
||||
return nyc
|
||||
.instrumenter()
|
||||
.instrumentSync(source, this.filename, { registerMap: () => {} });
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@ -55,9 +55,8 @@ test('log4js category inherit all appenders from direct parent', (batch) => {
|
||||
log4js.configure(config);
|
||||
|
||||
const child1CategoryName = 'catA.catB.cat1';
|
||||
const child1Appenders = categories.appendersForCategory(
|
||||
child1CategoryName
|
||||
);
|
||||
const child1Appenders =
|
||||
categories.appendersForCategory(child1CategoryName);
|
||||
const child1Level = categories.getLevelForCategory(child1CategoryName);
|
||||
|
||||
t.equal(child1Appenders.length, 1, 'inherited 1 appender');
|
||||
@ -68,9 +67,8 @@ test('log4js category inherit all appenders from direct parent', (batch) => {
|
||||
t.equal(child1Level.levelStr, 'DEBUG', 'child level overrides parent');
|
||||
|
||||
const child2CategoryName = 'catA.catB.cat2';
|
||||
const child2Appenders = categories.appendersForCategory(
|
||||
child2CategoryName
|
||||
);
|
||||
const child2Appenders =
|
||||
categories.appendersForCategory(child2CategoryName);
|
||||
const child2Level = categories.getLevelForCategory(child2CategoryName);
|
||||
|
||||
t.ok(child2Appenders);
|
||||
@ -124,9 +122,8 @@ test('log4js category inherit all appenders from direct parent', (batch) => {
|
||||
);
|
||||
|
||||
const firstParentName = 'catA.catB';
|
||||
const firstParentAppenders = categories.appendersForCategory(
|
||||
firstParentName
|
||||
);
|
||||
const firstParentAppenders =
|
||||
categories.appendersForCategory(firstParentName);
|
||||
|
||||
t.ok(firstParentAppenders);
|
||||
t.equal(firstParentAppenders.length, 2, 'ended up with 2 appenders');
|
||||
|
||||
@ -318,9 +318,8 @@ test('log4js configuration validation', (batch) => {
|
||||
`${path.join(mainPath, '../../node_modules/nyc/bin/cheese')}`
|
||||
] = testAppender('correct', result);
|
||||
// in tap v15, the main path is at root of log4js (run `DEBUG=log4js:appenders npm test > /dev/null` to check)
|
||||
sandboxConfig.requires[
|
||||
`${path.join(mainPath, '../../cheese')}`
|
||||
] = testAppender('correct', result);
|
||||
sandboxConfig.requires[`${path.join(mainPath, '../../cheese')}`] =
|
||||
testAppender('correct', result);
|
||||
// in node v6, there's an extra layer of node modules for some reason, so add this one to work around it
|
||||
sandboxConfig.requires[
|
||||
`${path.join(
|
||||
|
||||
@ -8,10 +8,10 @@ class MockLogger {
|
||||
constructor() {
|
||||
this.level = levels.TRACE;
|
||||
this.messages = [];
|
||||
this.log = function(level, message) {
|
||||
this.log = function (level, message) {
|
||||
this.messages.push({ level, message });
|
||||
};
|
||||
this.isLevelEnabled = function(level) {
|
||||
this.isLevelEnabled = function (level) {
|
||||
return level.isGreaterThanOrEqualTo(this.level);
|
||||
};
|
||||
}
|
||||
|
||||
@ -9,11 +9,11 @@ class MockLogger {
|
||||
this.messages = [];
|
||||
this.level = levels.TRACE;
|
||||
|
||||
this.log = function(level, message) {
|
||||
this.log = function (level, message) {
|
||||
this.messages.push({ level, message });
|
||||
};
|
||||
|
||||
this.isLevelEnabled = function(level) {
|
||||
this.isLevelEnabled = function (level) {
|
||||
return level.isGreaterThanOrEqualTo(this.level);
|
||||
};
|
||||
}
|
||||
|
||||
@ -3,9 +3,8 @@ const debug = require('debug');
|
||||
const sandbox = require('@log4js-node/sandboxed-module');
|
||||
|
||||
test('default settings', (batch) => {
|
||||
const originalListener = process.listeners('warning')[
|
||||
process.listeners('warning').length - 1
|
||||
];
|
||||
const originalListener =
|
||||
process.listeners('warning')[process.listeners('warning').length - 1];
|
||||
const warningListener = (error) => {
|
||||
if (error.name === 'DeprecationWarning') {
|
||||
if (
|
||||
@ -49,7 +48,7 @@ test('default settings', (batch) => {
|
||||
name: 'stdout',
|
||||
appender() {
|
||||
// deprecated
|
||||
return function(evt) {
|
||||
return function (evt) {
|
||||
output.push(evt);
|
||||
};
|
||||
},
|
||||
|
||||
@ -15,9 +15,8 @@ test('file appender single SIGHUP handler', (t) => {
|
||||
const initialListeners = process.listenerCount('SIGHUP');
|
||||
|
||||
let warning;
|
||||
const originalListener = process.listeners('warning')[
|
||||
process.listeners('warning').length - 1
|
||||
];
|
||||
const originalListener =
|
||||
process.listeners('warning')[process.listeners('warning').length - 1];
|
||||
const warningListener = (error) => {
|
||||
if (
|
||||
error.type === 'SIGHUP' &&
|
||||
|
||||
@ -249,9 +249,8 @@ test('log4js layouts', (batch) => {
|
||||
});
|
||||
|
||||
batch.test('patternLayout', (t) => {
|
||||
const originalListener = process.listeners('warning')[
|
||||
process.listeners('warning').length - 1
|
||||
];
|
||||
const originalListener =
|
||||
process.listeners('warning')[process.listeners('warning').length - 1];
|
||||
const warningListener = (error) => {
|
||||
if (error.name === 'DeprecationWarning') {
|
||||
if (
|
||||
@ -988,7 +987,7 @@ test('log4js layouts', (batch) => {
|
||||
t.test('should be able to add a layout', (assert) => {
|
||||
layouts.addLayout('test_layout', (config) => {
|
||||
assert.equal(config, 'test_config');
|
||||
return function(logEvent) {
|
||||
return function (logEvent) {
|
||||
return `TEST LAYOUT >${logEvent.data}`;
|
||||
};
|
||||
});
|
||||
|
||||
@ -309,7 +309,7 @@ test('../../lib/logger', (batch) => {
|
||||
|
||||
batch.test('should correctly change the parseCallStack function', (t) => {
|
||||
const logger = new Logger('stack');
|
||||
const parseFunction = function() {
|
||||
const parseFunction = function () {
|
||||
return {
|
||||
functionName: 'test function name',
|
||||
fileName: 'test file name',
|
||||
|
||||
@ -121,7 +121,7 @@ test('log4js', (batch) => {
|
||||
return null;
|
||||
}
|
||||
|
||||
thing.shutdown = function(cb) {
|
||||
thing.shutdown = function (cb) {
|
||||
events.shutdownCalled.push(true);
|
||||
cb();
|
||||
};
|
||||
@ -196,7 +196,7 @@ test('log4js', (batch) => {
|
||||
'./file': {
|
||||
configure(configuration) {
|
||||
appenderConfig = configuration;
|
||||
return function() {};
|
||||
return function () {};
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -220,7 +220,7 @@ test('log4js', (batch) => {
|
||||
const fakeStdoutAppender = {
|
||||
configure() {
|
||||
this.required = true;
|
||||
return function(evt) {
|
||||
return function (evt) {
|
||||
fakeStdoutAppender.evt = evt;
|
||||
};
|
||||
},
|
||||
|
||||
@ -136,8 +136,8 @@ test('multiFile appender', (batch) => {
|
||||
layouts
|
||||
);
|
||||
const originalShutdown = fileAppender.shutdown;
|
||||
fileAppender.shutdown = function(complete) {
|
||||
const onCallback = function() {
|
||||
fileAppender.shutdown = function (complete) {
|
||||
const onCallback = function () {
|
||||
complete(error);
|
||||
};
|
||||
originalShutdown(onCallback);
|
||||
|
||||
@ -181,7 +181,7 @@ test('TCP Appender', (batch) => {
|
||||
log4js.addLayout(
|
||||
'json',
|
||||
() =>
|
||||
function(logEvent) {
|
||||
function (logEvent) {
|
||||
return JSON.stringify({
|
||||
time: logEvent.startTime,
|
||||
message: logEvent.data[0],
|
||||
|
||||
@ -35,7 +35,7 @@ log4js.configure({
|
||||
log4js.addLayout(
|
||||
'json',
|
||||
(config) =>
|
||||
function(logEvent) {
|
||||
function (logEvent) {
|
||||
return JSON.stringify(logEvent) + config.separator;
|
||||
}
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user