Rcomian / bunyan-rotating-file-stream

Is an endpoint for bunyan that lets you control how much disk space logs take.
Other
29 stars 15 forks source link

write in batches #15

Closed NewbieAngular closed 6 years ago

NewbieAngular commented 6 years ago

Does this write to log file in batches? say 50 log statements in one batch? considering performance.

NewbieAngular commented 6 years ago

I am looking for a logger app that would write to file remotely, writing in batches helps performance

Rcomian commented 6 years ago

Yes it does.

Multiple writes in the same tick are always batched up and written in the next tick.

From quiet, the first log write(s) happens immediately and close the file. If other logs pile up behind it they are queued and written out in the next batch. This lets us get the writes on to disk as soon as possible whilst also allowing us to write as fast as possible.

With network systems, we do use filesystem timestamps for the time-based rotations, this might cause problems over some networked systems (like windows fileshare) although I haven't tested with this.

NewbieAngular commented 6 years ago

Thanks for the quick response ..

Is the batch size configurable? And, Can I override $Log of Angular to use this?

Rcomian commented 6 years ago

Hmm browser side logging isn't what this module's geared for - more server side only, which is why it's a separate module and not part of core.

So I'm not sure about the $Log and Angular thing.

As for batch size, it writes everything outstanding in the next batch. So if writing a batch for some reason takes 10 seconds, all the logs accrued in those 10 seconds will be written in the next batch.

Rcomian commented 6 years ago

That said, a batch is: