example: multiplex logging

This commit is contained in:
Rajeh Taher
2025-09-08 20:22:27 +03:00
parent 20693a59d0
commit 04d58e76f6
3 changed files with 119 additions and 3 deletions
+17 -1
View File
@@ -7,7 +7,23 @@ import open from 'open'
import fs from 'fs'
import P from 'pino'
const logger = P({ timestamp: () => `,"time":"${new Date().toJSON()}"` }, P.destination('./wa-logs.txt'))
const logger = P({
level: "trace",
transport: {
targets: [
{
target: "pino-pretty", // pretty-print for console
options: { colorize: true },
level: "trace",
},
{
target: "pino/file", // raw file output
options: { destination: './wa-logs.txt' },
level: "trace",
},
],
},
})
logger.level = 'trace'
const doReplies = process.argv.includes('--do-reply')