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

How to change output color? #430

Open
steph-lion opened this issue Jun 13, 2023 · 1 comment
Open

How to change output color? #430

steph-lion opened this issue Jun 13, 2023 · 1 comment

Comments

@steph-lion
Copy link

I have tried all kind of logs this library offers (info, debug, error etc..), but every output has a cyan color as the picture below

image

I would like to change and set a custom color for each log. For example, the trace log should have the same color as TRACE itself.

Here is my configuration:

import { pino } from 'pino';

const logger = pino({
  level: 'trace',
  transport: {
    target: 'pino-pretty',
  },
});

export { logger };
@jsumners
Copy link
Member

👋 we don't currently support this with the default colorization. The default colorizer colors messages by:

  1. https://github.com/pinojs/pino-pretty/blob/bf973c749b8516998e8aeab3dac39591db314586/lib/colors.js#LL78C46-L78C46
  2. message: cyan,

I also don't think it's currently possible to achieve the desired result by providing a custom colorizer function (when using this module programattically) as the internal API is colorizer.message(str) without any parameters to base color choosing on.

This could be an interesting feature to add, though. Would you like to work on it?

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