'PinoWarning: prettyPrint is deprecated, look at https://github.com/pinojs/pino-pretty for alternatives

I suddenly started getting following error in my nodejs project

[PINODEP008] PinoWarning: prettyPrint is deprecated, look at https://github.com/pinojs/pino-pretty for alternatives.

What to do? App is crashing

(Use `node --trace-warnings ...` to show where the warning was created)
[nodemon] app crashed - waiting for file changes before starting...


Solution 1:[1]

If you are looking for the solution of [PINODEP008] PinoWarning: prettyPrint is deprecated, look at https://github.com/pinojs/pino-pretty for alternatives, then, I solved the same in my application, as below:

Instead of

pinoHttp: {
    prettyPrint: {
        ignore:'req.headers,res',
    }
}

Updated this:

pinoHttp: {
    transport: {
        target: 'pino-pretty',
        options: {
            ignore:'req.headers,res',
        }
    }
}

Reference: https://github.com/Zialus/TW-Minesweeper-Server/commit/f67ae7e33434fd36d14760f1c5572cefd52bae92

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1