Open benatsila opened 2 years ago
@benatsila Hello, I have same issue. Did you resolved it ?
I've also seen the same issue.
I don't know if the log entry isn't being removed from the internal pendingLogs
stack, or if the 2nd log entry is getting appended to the internal pendingLogs
before the 1st entry is done sending, and then when it tries to pop the sent log from the pendingLogs
stack, it ends up popping the 2nd log entry instead of the first one.
It seems to be timing-dependent, however. If the 2nd call to .log()
is made very quickly after the 1st call, then the problem occurs - only the 1st message is sent. If, however, you wait some time before calling .log()
for the 2nd time (as in, long enough for the 1st request to have finished) it doesn't happen.
For example:
sumoLogger.log('This is call number one');
sumoLogger.log('This is call number two');
This results in only 'This is call number one' ending up in the logs. However:
sumoLogger.log('This is call number one');
setTimeout(() => sumoLogger.log('This is call numer two'), 5000);
This results in both messages ending up in the logs.
Similarly, if you set the interval
property in the Sumo options to something like 5000 (5 seconds), then both log message are sent as expected:
const sumoLogger = new SumoLogger({
endpoint: MY_ENDPOINT,
interval: 5000
});
sumoLogger.log('This is call number one');
sumoLogger.log('This is call number two');
So, for me, as a workaround I've set the interval
option to something around a couple of seconds (to allow the requests to complete before sending the next one). I'm not sure what a permanent fix would be for this, though.
Hi. I'm not sure if this is a bug, intended behavior, or a result of me not configuring my SumoLogger instance appropriately. It seems like I can call the
log
method on a SumoLogger instance one time. Subsequent calls to log seem to do nothing. I've resorted to creating a new SumoLogger instance per log msg in my wrapper, but this doesn't seem correct. Here's how I'm configuring the SumoLogger. Am I missing something?