Console-Extra
A module that allows logging to multiple streams simultaneously.
Setup
const Console = require('console-extra').ConsoleAsync;
delete console;
console = await Console(process.stdout, process.stderr); //bound to out and err respectively
//or
console = await Console(process.stdout, process.stderr, 'stream3.log'); //all bound to both err and out!
//or
console = await Console([ process.stdout, process.stderr, 'stream3.log', ... ]); //all bound to both err and out
//or
console = await Console({
output: process.stdout,
error: process.stderr
}); //bound to out and err respectively
//or
console = await Console({
output: [ process.stdout, process.stderr ],
error: 'file.txt'
}); //bound to out and err respectively - BEST
This module extends the builtin
Console
Use the non-async version only for already-opened and writable streams!