Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unfortunately does not work for me. #18

Open
xCruziX opened this issue Jul 19, 2021 · 4 comments
Open

Unfortunately does not work for me. #18

xCruziX opened this issue Jul 19, 2021 · 4 comments

Comments

@xCruziX
Copy link

xCruziX commented Jul 19, 2021

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

@jsumners
Copy link
Member

jsumners commented Jul 19, 2021

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

@xCruziX
Copy link
Author

xCruziX commented Jul 20, 2021

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

@jsumners
Copy link
Member

image

The only change I made is to remove whatever that path@0.12.7 package is. The path module is a Node core module.

@xCruziX
Copy link
Author

xCruziX commented Jul 22, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants