Closed sungam3r closed 3 years ago
Hi @sungam3r,
it can definitely be handy to clear log messages when you are testing. Currently this is possible through the Dispose
method on the sink: https://github.com/sandermvanvliet/SerilogSinksInMemory#clearing-log-events-between-tests
The main reason that the sink does not have a Clear
method is to encourage the right usage of the sink which is to have only one instance of it per test so that clearing it wouldn't be necessary.
Unfortunately we've seen that with MS Test this doesn't always work and that's why the Dispose
pattern was introduced to solve that particular problem.
However, I can't claim to know all use cases so I'm curious to how you would use this. Do you have an example of a test where you would use Clear
?
OK. I just did not notice Dispose
method, it happens.
No worries!
When testing, it can be convenient to clear messages.