serilog-contrib / SerilogSinksInMemory

In-memory sink for Serilog to use for testing
MIT License
53 stars 7 forks source link

Make Inmemory Instance disposable #3

Closed jesusnac closed 4 years ago

jesusnac commented 4 years ago

Thank you very much for this component. I currently use it keep a register of issues I found while I am parsing some text files.

Since the Instance object is read only, it is not possible to clear the list of events logged. Could it be possible to add a IDisposable interface so it can be called from Serilog SaveandClose method and implement the Dispose method to reset the EventList?

Thanks in advance.

sandermvanvliet commented 4 years ago

Good suggestion! I’ll see if I can pick this up soon, we’ve actually ran into this a couple of times but changed the tests instead.

sandermvanvliet commented 4 years ago

@jesusnac I've implemented this in PR #4 This should pretty much do what you need. Let me know what you think, I'll probably push this to NuGet in a day or so.

jesusnac commented 4 years ago

Great!! Thank you so much!