pino-arborsculpture
pino-arborsculpture copied to clipboard
Unfortunately does not work for me.
Hi,
i try to get this to work but the loglevels seems to remain.
The following code is just a test and createLogger creates a child logger. Tried with mainlogger also.
let testLogger = createLogger('test');
const arbor = new Arborsculpt({
path: path.join(__dirname, 'overrideLogLevel.json'),
loggers: [mainLogger, testLogger],
interval: 5 * 1000, // in milliseconds
});
setTimeout(() => {
testLogger.error('ERROR');
testLogger.debug('DEBUG');
},10*1000);
Content of overrideLogLevel.json:
{
"level": "error"
}
Both logs appears but
There's a lot missing from this report. Can you provide a single index.js
and package.json
that replicates the issue?
Sure. Index.js:
const pino = require('pino');
const Arborsculpt = require('pino-arborsculpture');
const path = require('path');
const mainLogger = pino({level: 'debug'});
const arbor = new Arborsculpt({
path: path.join(__dirname, 'overrideLogLevel.json'),
loggers: [mainLogger],
interval: 5 * 1000,
});
setTimeout(() => {
mainLogger.error('ERROR');
mainLogger.debug('DEBUG');
},10*1000);
package.json:
{
"name": "abscur",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {
"path": "^0.12.7",
"pino": "^6.12.0",
"pino-arborsculpture": "^1.1.0"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
overrideLogLevel.json:
{
"level": "error"
}
Output:
{"level":50,"time":1626762831964,"pid":2879,"hostname":"SoSafe-NTB2-041.local","msg":"ERROR"}
{"level":20,"time":1626762831966,"pid":2879,"hostname":"SoSafe-NTB2-041.local","msg":"DEBUG"}
The only change I made is to remove whatever that [email protected]
package is. The path
module is a Node core module.
Okay, this is weird, it works on my local windows maschine too, regardless of the path package. I've got the wrong output on my work maschine with mac. Tomorrow I give it another try.