stream-test.js 449 B

1234567891011121314
  1. // const fs = require('fs');
  2. const streamroller = require('./lib/index');
  3. const stream = new streamroller.RollingFileStream('stream-test.log');
  4. // const stream = fs.createWriteStream('stream-test.log');
  5. for (let i = 0; i < 1000000; i += 1) {
  6. stream.write('[2017-06-15 08:16:52.760] [INFO] memory-test - Doing something.\n', 'utf-8');
  7. if (i % 5000 === 0) {
  8. console.log("Wrote ", i);
  9. }
  10. }
  11. stream.end('\n', () => { console.log("done"); });