Skip to content
This repository has been archived by the owner on Nov 9, 2018. It is now read-only.

Create "xunit" logger provider #243

Closed
analogrelay opened this issue Feb 2, 2017 · 5 comments
Closed

Create "xunit" logger provider #243

analogrelay opened this issue Feb 2, 2017 · 5 comments

Comments

@analogrelay
Copy link
Contributor

In xunit, it is recommended that "console" output be written to ITestOutputHelper rather than the Console. We should provide a Logger to plug in to ILoggerFactory which writes to this. See https://github.com/aspnet/MusicStore/blob/dev/test/E2ETests/Common/XunitLogger.cs for an example.

/cc @natemcmaster

@Eilon
Copy link
Member

Eilon commented Feb 28, 2017

We can certainly do this, but what would actually wire it up in our tests? And... what problem in our tests does it solve?

@analogrelay
Copy link
Contributor Author

  1. The new test host in dotnet test suppresses Console output. So if we want to write something out, we need to use this.

  2. The ITestOutputHelper collects output for a single test and ensures it is rendered as a discrete unit, which is important when doing parallel testing

  3. Tests would have to wire it up themselves. This is for tests that currently create a Logger Factory and attach the Console logger. Mostly functional tests that do deployment.

@Eilon
Copy link
Member

Eilon commented Mar 1, 2017

Ah, got it, this makes sense. Are there any tests where we know we'd want to use this ASAP? I want to make sure that whoever I assign this to will have an actual use case for it 😄

@analogrelay
Copy link
Contributor Author

Well there are places we already have it, https://github.com/aspnet/SignalR/blob/dev/test/Microsoft.AspNetCore.SignalR.Tests/XUnitLoggerProvider.cs , https://github.com/aspnet/MusicStore/blob/dev/test/E2ETests/Common/XunitLogger.cs , etc.

So this more about making it a common component, to avoid copy 🍝

analogrelay added a commit that referenced this issue Mar 16, 2017
analogrelay added a commit that referenced this issue Mar 16, 2017
analogrelay added a commit that referenced this issue Mar 16, 2017
@analogrelay
Copy link
Contributor Author

Closing in lieu of aspnet/Logging#574

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants