-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add XunitLoggerProvider #81
Conversation
Which it be much more work to just consistently use it everywhere now? |
It's not much more work to use it in places where we are currently using NullLoggerFactory.Instance. It's harder in places where we're mocking the ILoggerFactory. I'll try adding logging to the tests using NullLoggerFactory.Instance before merging. |
Do we actually need to mock it? Seems like we could always just pass in the xunit logger. I don't know what the value is of mocking the logger, when we could either use a null logger or a test one. |
You're right. We don't. I assumed the mocks were being used to verify certain logs were emitted. If that were the case, it would be less trivial to updated it to also use the xunit logger. But it turns out, the mocks were used as a inconvenient substitute for NullLoggerFactory.Instance and were easy to replace. I've not updated every test that provides an ILoggerFactory to be a LoggedTest that uses the xunit logger. I think this should now be good to merge. |
So far, I'm only using the XunitLoggerProvider in SseServerIntegrationTests.cs and ClientIntegrationTests.cs since those previously logged to the console which can be hard to see when using the xunit test runner. After this change, you can easily see logs in the test runner like this.
We can probably integrate this in more places, and that should be easier to do going forward with the XunitLoggerProvider and LoggedTest base class.