[enhancement]Emmit pause event for node js when buffer is full#938
[enhancement]Emmit pause event for node js when buffer is full#938nomiddlename merged 3 commits intolog4js-node:masterfrom
Conversation
|
Thanks for this, could you add a test that covers the change please? |
|
Yes, I’ll add the test as soon as possible. |
…ain event emitted
Codecov Report
@@ Coverage Diff @@
## master #938 +/- ##
==========================================
+ Coverage 98.6% 98.61% +<.01%
==========================================
Files 25 25
Lines 1006 1009 +3
==========================================
+ Hits 992 995 +3
Misses 14 14
Continue to review full report at Codecov.
|
|
@nomiddlename I've added test for this situation. |
nomiddlename
left a comment
There was a problem hiding this comment.
Sorry for not getting back to you sooner, I completely missed your updates. Thanks for working on this. I'm wondering if we should namespace the event that gets emitted (e.g. "log4js:pause" instead of just "pause") to avoid clashes. This event will work fine for simple logging cases, I think, but if you have a more complicated set up (multiple appenders, categories) then a user might need to know which appender is causing the event. That way they could pause the logging that goes to a file, but continue sending logs over the network, for example. What do you think?
|
thanks @nomiddlename for response, your are right I'will add the namespace to event. |
|
Yep, I agree - let's start with this, and see if it's an approach that works for people. I'll create a couple of extra github issues to add documentation and also make the same changes in the dateFile appender. Once those are done, I'll push it out to NPM. |
|
To be clear, I don't expect you to work on those two extra issues - I just created them so that I can track what else needs to be done before I can release the change. If you want to work on them, that's awesome, but you don't have to. I'll work on them as I get time. |
|
Published to npm in [email protected] |
Hi,
I made some change in file.js module, so when the buffer is full the 'pause' event will emit, and after now we can listen to this event. When this event is emitted we can stop logging or maybe send 'server too busy' response and wait till the drain event emitted. With these changes logger will not stop and just an event emitted, and this is possible if someone want to continue logging.