You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ruby version independent
Semantic Logger version 4.12.0
Requested Improvement
The CaptureLogEvents logger for testing is useful, but when I tried to access the events array before any log messages were logged, it was not yet initialized. So I had to do an additional check for nil when accessing the events array.
I suggest initializing the events array in the constructor rather than lazily initializing it in the log method. This way, callers can be guaranteed to get the array whether or not any messages have been logged yet.
Also, in my use of this logger, I found it useful to be able to clear the array of events. I recommend adding a clear method that does this.
The text was updated successfully, but these errors were encountered:
Environment
Ruby version independent
Semantic Logger version 4.12.0
Requested Improvement
The
CaptureLogEvents
logger for testing is useful, but when I tried to access theevents
array before any log messages were logged, it was not yet initialized. So I had to do an additional check for nil when accessing the events array.I suggest initializing the events array in the constructor rather than lazily initializing it in the
log
method. This way, callers can be guaranteed to get the array whether or not any messages have been logged yet.Also, in my use of this logger, I found it useful to be able to clear the array of events. I recommend adding a clear method that does this.
The text was updated successfully, but these errors were encountered: