-
Notifications
You must be signed in to change notification settings - Fork 936
Open
Description
Hello there,
I've looked for a solution to my issue but couldn't figure it out. Sorry if I overlooked somewhere.
I'm trying to log with multiple transports in my code but I can't manage to get the debug and trace level to work:
const transport = pino.transport({
targets: [
{
target: 'pino-pretty',
level: 'trace'
},
{
target: 'pino/file',
options: {
destination: logFilePath // this goes to src/logs/logs.log and it works
},
level: 'warn'
},
{
target: './pino-discord-transport', // custom transport that also work but still without the debug/trace level
level: 'warn'
}
]
})The logger in itself doesn't have anything fancy
export const logger = pino(
{
base: {},
mixin(_, level) {
return level >= pino.levels.values.warn ? { traceId: randomUUID() } : {} // I don't think that's the issue, otherwise info wouldn't work
},
timestamp: pino.stdTimeFunctions.isoTime
},
transport
)In my index.ts I have this for testing
logger.trace('trace')
logger.debug('debug')
logger.info('info')
logger.warn('warn')
logger.error('error')And I get this in pino pretty:
[13:45:52.145] INFO: info
[13:45:52.145] WARN: warn
traceId: "6a7667bd-8811-4ced-baab-f2975b2e07af"
[13:45:52.146] ERROR: error
traceId: "cdbc6362-57ac-4adb-9990-a544251e80a3"
and this in my file
{"level":40,"time":"2025-12-03T12:47:13.199Z","traceId":"695d6fe8-e2a5-4641-96de-3f452679f99b","msg":"warn"}
{"level":50,"time":"2025-12-03T12:47:13.199Z","traceId":"849d7299-715e-4875-b19a-e34e9dc66aa4","msg":"error"}I hope someone can help me or direct me towards a solution,
Thank you!
- Node.js: 22.18.0
- pnpm: 10.15.1
- pino: 10.1.0
- pino-abstract-transport: 3.0.0
Metadata
Metadata
Assignees
Labels
No labels