I'm trying to use prettyprint: true on fastify logger options like this:
const build = require("./app");
const startServer = async () => {
try {
const app = await build({
logger: {
prettyPrint: true
},
});
const PORT = process.env.PORT;
await app.listen(PORT);
} catch (err) {
console.log(err);
process.exit(1);
}
};
startServer().catch();
This code is from official docs from here and here.
The pino-pretty package is installed
And I get this error when I try to run server:
const formatted = pretty(typeof redact === 'function' ? redact(obj) : obj)
^
TypeError: pretty is not a function
Checked for this line of code (/node_modules/pino/lib/tools.js 282), pretty type is object, but in the code it is used as function
const formatted = pretty(typeof redact === 'function' ? redact(obj) : obj)
Any ideas?