trbenning / serilog-sinks-xunit

The xunit test output sink for Serilog
MIT License
83 stars 8 forks source link

Nice addition to the serilog xunit family #23

Open mwpowellhtx opened 4 years ago

mwpowellhtx commented 4 years ago

I am trying to reconfigure my serilog logging for unit test verification in my scenarios and I can only get the reconfigure to work as follows:

// In BDD style...
"...".x(() => config = config.WriteTo.TestOutput(this.OutputHelper).MinimumLevel.Verbose());

Trying to follow the examples does not work, i.e.:

"...".x(() => config = config.WriteTo.TestOutput(this.OutputHelper, LogEventLevel.Verbose));

Then I turn around and assign the logger:

"...".x(() => currentLogInstance.Logger = config.CreateLogger());

As long as I used the fluent configuration, all was well and indeed I received Verbose output like I expected. When I did not, the base configuration was set for Information, I think. So, no Debug, no Verbose, and so on. Half as expected, i.e. by design in its configuration, but did not configure like I wanted.

So... It's an acceptable workaround, but thought you might like to know.