Skip to content
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

MvvmCross.Test.TestLogProvider not logging anywhere #3193

Closed
7 tasks done
HaraldMuehlhoffCC opened this issue Nov 8, 2018 · 3 comments
Closed
7 tasks done

MvvmCross.Test.TestLogProvider not logging anywhere #3193

HaraldMuehlhoffCC opened this issue Nov 8, 2018 · 3 comments
Labels
t/feature Feature request type up-for-grabs Issues up for grabs by anyone
Milestone

Comments

@HaraldMuehlhoffCC
Copy link
Contributor

HaraldMuehlhoffCC commented Nov 8, 2018

🏗 Enhancement Proposal

The TestLogProvider seems almost functional but the formattedMessage isn't going anywhere. Why is it so and wouldn't it be nice if it was shown?

            protected void Write(MvxLogLevel logLevel, string message, Exception e = null)
            {
                var formattedMessage = MessageFormatter(_name, logLevel, message, e);

                //Console.WriteLine(formattedMessage);
            }

BTW - Visual Studio 2017 15.8.9 exited several times without message after I opened the MvvmCross.sln.

Pitch

In UnitTest projects Mvx.IoCProvider.Resolve<IMvxLogProvider>() returns a TestLogProvider. Sadly this provider does a lot of what it is supposed to do but the one statement showing the log message is commented out. Testing complex code could profit from some log output.

Platforms affected (mark all that apply)

  • 📱 iOS
  • 🤖 Android
  • 🏁 WPF
  • 🌎 UWP
  • 🍎 MacOS
  • 📺 tvOS
  • 🐒 Xamarin.Forms
@Cheesebaron Cheesebaron added t/feature Feature request type up-for-grabs Issues up for grabs by anyone labels Nov 12, 2018
@Cheesebaron
Copy link
Member

I guess it would be appropriate to have it log to xUnit ITestOutputHelper, which could be configurable through the fixture maybe. Thanks for reporting this 👍

@Cheesebaron
Copy link
Member

I was looking into this yesterday. xUnit doesn't seem to allow injecting ITestOutputHelper into fixtures.

It does however allow you to use IMessageSink which will become a DiagnosticMessageSink at run-time. However, this doesn't really add anything to the output.

So I guess the better solution would be to allow you to provide your own TestLogProvider which you can control the implementation, since we can't do it from the fixture.

@HaraldMuehlhoffCC
Copy link
Contributor Author

@Cheesebaron Thank you for looking into it! The ability to provide my own TestLogProvider would certainly be a step in the right direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t/feature Feature request type up-for-grabs Issues up for grabs by anyone
Development

No branches or pull requests

3 participants