fix(Log4Net): Implement new Append method on GoogleStackDriver#15571
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the GoogleStackdriverAppender by introducing a new Append overload that accepts IEnumerable and updating the existing array-based Append method to delegate to it. Feedback suggests adding a null check for the loggingEvents parameter in the new method to enhance robustness against null inputs.
| protected override void Append(IEnumerable<LoggingEvent> loggingEvents) | ||
| { | ||
| if (!_isActivated) |
There was a problem hiding this comment.
The new Append(IEnumerable<LoggingEvent> loggingEvents) method should ideally include a null check for the loggingEvents parameter before accessing it or checking _isActivated, especially since it is a protected method that could be called by subclasses or directly within the class. Although log4net typically ensures non-null arguments in its pipeline, adding a guard clause improves robustness.
protected override void Append(IEnumerable<LoggingEvent> loggingEvents)
{
if (loggingEvents == null)
{
return;
}
if (!_isActivated)
Using
log4net3.3.0 should haveAppend(IEnumerable<LoggingEvent>)implemented otherwise the bulk append method resolves to multiple single log entry appends (breaking some of our tests).