Pino-pretty customPrettifiers doesnt work

195 Views Asked by At

I want to contomize the time output in terminal with customPrettifiers but it gives me error

import pino from "pino"

const logger = pino({
    transport: {
        targets: [
            { target: "pino-pretty", options: { destination: "./logs.log", mkdir: true, colorize: false } },
            {
                target: "pino-pretty",
                options: {
                    destination: process.stdout.fd,
                    customPrettifiers: {
                        time: (timestamp) => `Time: ${timestamp}`,
                    },
                },
            },
        ],
    },
})

logger.info("hi")

gives me error :

node:internal/per_context/domexception:53
    ErrorCaptureStackTrace(this);
    ^
DOMException [DataCloneError]: (timestamp) => `Time: ${timestamp}` could not be cloned.
    at new DOMException (node:internal/per_context/domexception:53:5)
    at new Worker (node:internal/worker:266:17)
0

There are 0 best solutions below