pinojs / pino

🌲 super fast, all natural json logger
http://getpino.io
MIT License
14.21k stars 875 forks source link

Log to terminal & write to the file #1523

Closed jan53n closed 2 years ago

jan53n commented 2 years ago

Hi, i want to re-configure pino in way that i can write the logs to a log file and also to the terminal

this is my conf:

const pino = require('pino');

const transport = pino.transport({
    target: 'pino/file',
    options: { destination: './app.log' }
});

const logger = pino(transport);

function l(type, payload) {
    const t = logger.child({ type });
    t.info(payload);
}
mcollina commented 2 years ago

This example should get you what you want: https://github.com/pinojs/pino/blob/master/examples/transport.js.

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.