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

Add colors! #35

Open
mcollina opened this issue Feb 29, 2024 · 5 comments · Fixed by #36 · May be fixed by #42
Open

Add colors! #35

mcollina opened this issue Feb 29, 2024 · 5 comments · Fixed by #36 · May be fixed by #42
Labels
good first issue Good for newcomers

Comments

@mcollina
Copy link
Member

As titled, it would be awesome if this transport added colors!

@Uzlopak
Copy link
Contributor

Uzlopak commented Feb 29, 2024

Do you have a code example on how you would use it?
How many colors?

@mcollina
Copy link
Member Author

Maybe check out pino-colada and pino-pretty for inspiration?

@mcollina mcollina added the good first issue Good for newcomers label Feb 29, 2024
@mcollina mcollina reopened this Apr 30, 2024
@mcollina
Copy link
Member Author

I've been trying to have one-line-logger be colored by default, but I couldn't make it work.

What I would expect it's something slightly different and "nicer" to read.

This is the output of pino-pretty:

Screenshot 2024-04-30 at 12 51 33

I would expect this module to retain the color of the level.

This is with the default settings:

Screenshot 2024-04-30 at 12 53 11

However I need to force a colorize: true option to get it to where it should be:

const fastify = require('fastify')({
  logger: {
    transport: {
      target: './index.js',
      options: {
        colorize: true,
      }
    }
  }
})

Screenshot 2024-04-30 at 12 55 23

There should not be a need to foce colorize: true.

@mcollina
Copy link
Member Author

cc @synapse @simoneb

@synapse synapse linked a pull request May 22, 2024 that will close this issue
4 tasks
@synapse
Copy link
Contributor

synapse commented May 22, 2024

@mcollina @simoneb create a new PR here #42 that enables colors automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
3 participants