pinojs / pino-pretty

🌲Basic prettifier for Pino log lines

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ho to properly pass log level via cli?

enricoangelon opened this issue · comments

Hello, I tried following the documentation to pass the levelVal property via CLI by using the -L flag but doesn't seem to have any effect in my workspace, I tried passing both -L 10 and -L 'trace' but logger.levelVal remains the same. Thanks in advice.

What are you expecting? The docs state that logs will be filtered according to that value. They do not state that the logger generating the logs will have its level changed.

This could also mean that if I put a low level of filtering, it shouldn't filter me logs such as trace, it's highly questionable. Anyway, if this isn't the correct flag, which one should I use?

I don't know what you're asking.

'use strict'

const log = require('pino')({ level: 'trace' })

log.info('not filtered')
log.debug('not filtered')
log.trace('filtered')
❯ node index.js | pino-pretty -L debug
[08:46:11.194] INFO (24434): not filtered
[08:46:11.195] DEBUG (24434): not filtered

Now I understand the concept better, but if I wanted pino to have for example { level: 'info' } but when I pipe with pino-pretty I can also show other underlying levels (trace, debug...), it is possible through some cli argument?

Please read the docs for this tool. That is not in scope.