logger console + file

This commit is contained in:
Andreas Knuth 2026-03-08 16:09:30 -05:00
parent 62221e8121
commit 29f360ece8
1 changed files with 20 additions and 7 deletions

View File

@ -104,13 +104,26 @@ function ensureFileStream(): WriteStream | null {
const logger = pino({ const logger = pino({
level: 'info', level: 'info',
transport: { transport: {
target: 'pino-pretty', targets: [
options: { {
colorize: true, // 1. Schicke bunte Logs in die Konsole (für docker compose logs -f)
translateTime: 'SYS:yyyy-mm-dd HH:MM:ss', target: 'pino-pretty',
ignore: 'pid,hostname', options: {
singleLine: true colorize: true,
} translateTime: 'SYS:yyyy-mm-dd HH:MM:ss',
ignore: 'pid,hostname',
singleLine: true
}
},
{
// 2. Schreibe gleichzeitig alles unformatiert in die Datei
target: 'pino/file',
options: {
destination: '/var/log/email-worker/worker.log',
mkdir: true
}
}
]
} }
}); });