pinojs / pino-pretty

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

option to turn off prettyprint in api #329

Closed rubiin closed 2 years ago

rubiin commented 2 years ago

Using pretty print along with file in transport. However i cannot seem to turn of pretty printing. Is there anything I am missing

mcollina commented 2 years ago

can you make an example?

rubiin commented 2 years ago

I am on nestjs using nestjs-pino

Heres how I am logging on std as well as file using transports:


{
                            pinoHttp: {
                        level: "info",
                        redact: {
                            paths: ["req.headers.authorization"],
                            remove: true,
                        },
                        transport: {
                            targets: [
                                {
                                    target: "pino/file",
                                    level: "info",
                                    options: {
                                        destination: "logs/info.log",
                                        mkdir: true,
                                    },
                                },
                                {
                                    target: "pino-pretty",
                                    level: "info",
                                    options: {
                                        colorize: true,
                                        prettyPrint: false,
                                        translateTime: true,
                                        ignore: "pid,hostname",
                                    },
                                },
                            ],
                        },
                    },
                };
rubiin commented 2 years ago

I think pino-pretty does not have a option to turn off prettyPrint at the moment

jsumners commented 2 years ago

It doesn't and it won't. If you do not want to pretty print logs, do not send them to the pretty print module.

mcollina commented 2 years ago

Thanks for reporting. We do not have the resources to support Nest.js users. Please refer to the Nest Discord channel (support) for such questions.