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,6 +104,9 @@ function ensureFileStream(): WriteStream | null {
const logger = pino({ const logger = pino({
level: 'info', level: 'info',
transport: { transport: {
targets: [
{
// 1. Schicke bunte Logs in die Konsole (für docker compose logs -f)
target: 'pino-pretty', target: 'pino-pretty',
options: { options: {
colorize: true, colorize: true,
@ -111,6 +114,16 @@ const logger = pino({
ignore: 'pid,hostname', ignore: 'pid,hostname',
singleLine: true singleLine: true
} }
},
{
// 2. Schreibe gleichzeitig alles unformatiert in die Datei
target: 'pino/file',
options: {
destination: '/var/log/email-worker/worker.log',
mkdir: true
}
}
]
} }
}); });