/anlog-sinks-xunit

Allows writing of logs to the xUnit test console using Anlog

Primary LanguageC#MIT LicenseMIT

Anlog

(Yet) Another .NET Logger - xUnit Sink

Currently the project is DISCONTINUED. However, feel free to fork it and continue its development!

NuGet Version

Allows writing of logs to the xUnit test console using Anlog.

Contents

  1. Quick start
  2. License

Quick start

Install Anlog.Sinks.xUnit from the NuGet Gallery in the test project:

Install-Package Anlog.Sinks.xUnit

In a xUnit test, receive the ITestOutputHelper through constructor and call the WriteLogs() method:

using Xunit;
using Xunit.Abstractions;
using Anlog.Sinks.XUnit;

namespace MyProject.Tests
{
    public sealed class MyTest
    {
        public MyTest(ITestOutputHelper output)
        {
            output.WriteLogs();
        }
        
        [Fact]
        public void WhenSomething_ThenTest()
        {
            ...
        }
    }
}

Any logs written to Anlog will then be forwarded to the xUnit test output console.

License

Licensed under the The MIT License (MIT). Please see LICENSE for more information.