log to file

This commit is contained in:
Andrzej Stepien 2023-08-11 17:43:19 +02:00
parent 56266b4872
commit ee2415f454
1 changed files with 7 additions and 5 deletions

View File

@ -4,10 +4,10 @@ import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url); const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename); const __dirname = path.dirname(__filename);
// const fileTransport = pino.transport({ const fileTransport = pino.transport({
// target: 'pino/file', target: 'pino/file',
// options: { destination: `${__dirname}/app.log` }, options: { destination: `${__dirname}/app.log` },
// }); });
export default pino({ export default pino({
level: process.env.PINO_LOG_LEVEL || 'trace', level: process.env.PINO_LOG_LEVEL || 'trace',
@ -17,4 +17,6 @@ export default pino({
}, },
}, },
timestamp: pino.stdTimeFunctions.isoTime, timestamp: pino.stdTimeFunctions.isoTime,
}) },
fileTransport
)