pino-arborsculpture icon indicating copy to clipboard operation
pino-arborsculpture copied to clipboard

Unfortunately does not work for me.

Open xcruzix opened this issue 3 years ago • 4 comments

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

xcruzix avatar Jul 19 '21 14:07 xcruzix

There's a lot missing from this report. Can you provide a single index.js and package.json that replicates the issue?

jsumners avatar Jul 19 '21 17:07 jsumners

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"}

xcruzix avatar Jul 20 '21 06:07 xcruzix

image

The only change I made is to remove whatever that [email protected] package is. The path module is a Node core module.

jsumners avatar Jul 20 '21 12:07 jsumners

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.

xcruzix avatar Jul 22 '21 17:07 xcruzix