Node.js / winston - Can I add a log?

I use winston.log to add log files. Every time I restart the application, a log exists, and a new one is created.

Is there a way to add log files? so it will be deleted only during the turn?

Here is the relevant code:

var winston = require('winston'); var loggerNoCache = new(winston.Logger)({ transports: [ new(winston.transports.File)({ filename: '/var/log/logNo.log', options: { highWaterMark: 32 } }) ] }); 
+5
source share
1 answer

You can pass an extra WriteableStream through the stream property, perhaps something like:

 new(winston.transports.File)({ stream: fs.createWriteStream('/var/log/logNo.log', {flags: 'a'}), options: { ... 
+4
source

Source: https://habr.com/ru/post/1214924/


All Articles