pinojs / pino-pretty

🌲Basic prettifier for Pino log lines
MIT License
1.27k stars 150 forks source link

--minimumLevel / -L flag doesn't seem to be working #410

Closed mysticflute closed 1 year ago

mysticflute commented 1 year ago

I'm using pino-pretty in my project and trying to set the level to debug via a cli flag. I have this in my package.json scripts:

"dev": "next dev | pino-pretty -L debug"

I've tried --minimumLevel=debug, --minimumLevel debug, nothing seems to be working.

I've tried other flags such as -S and they did work.

mysticflute commented 1 year ago

Using "pino": "^8.11.0" and "pino-pretty": "^9.4.0"

mcollina commented 1 year ago

Thanks for reporting!

Can you provide steps to reproduce? We often need a reproducible example, e.g. some code that allows someone else to recreate your problem by just copying and pasting it. If it involves more than a couple of different file, create a new repository on GitHub and add a link to that.

mysticflute commented 1 year ago

Here's a very basic repo... just a node script that outputs to the logger: https://github.com/mysticflute/pino-pretty-test

Try it with npm test or or node index.js | npx pino-pretty -L debug

mcollina commented 1 year ago

You are not setting the log level on the main pino logger, it's not emitting debut level logs.

mysticflute commented 1 year ago

Are you saying the L flag only operates as a secondary log level, it does not affect the pino log level?

mcollina commented 1 year ago

Exactly, they are two separate processes

jsumners commented 1 year ago

It is a filter. Note that the help text for that switch indicates so.

mysticflute commented 1 year ago

Thanks. In hindsight that does make sense. Using both libraries for the first time, I wasn't thinking about how pino-pretty doesn't directly change any of the behavior of pino.