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

pino-pretty add "name" property to process number instead of log it #549

Open
leozhao0709 opened this issue Nov 28, 2024 · 4 comments
Open

Comments

@leozhao0709
Copy link

const logger = pino({
  level: config.LOGGER.LEVEL,
  transport:
    process.env.NODE_ENV !== 'production'
      ? {
          target: 'pino-pretty',
        }
      : undefined,
});

logger.info({ name: '123', orderBy: [] });

with pino-pretty, it logs like this:

Snipaste_2024-11-27_16-53-56

in production with json format, I can see the name property in logs. So I think this is just a pino-pretty issue.

@jsumners
Copy link
Member

Would you like to send a Pull Request to address this issue? Remember to add unit tests.

@leozhao0709
Copy link
Author

@jsumners I was looking the source code and seeing this part

https://github.com/pinojs/pino-pretty/blob/master/lib/constants.js#L45-L54

Seems these are pre-defined keys that used by Pino? In my local, I only see 'pid', 'hostname', 'level' and 'time' was used by pino. But if other keys like 'name', 'timestamp' and 'caller' are some predefined keys that may used by pino or ecosystem, then probably we can't fix it.

Can you confirm these keys? If these are used by Pino on purpose, we may need document it somewhere.

@jsumners
Copy link
Member

I have not been able to follow the description of the problem you are encountering. I cannot answer.

@qmzmdqs
Copy link

qmzmdqs commented Dec 10, 2024

bunyan

name This is too common. Maybe change the field.

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

3 participants