NetEvolve.Logging.XUnit 1.1.14

There is a newer version of this package available.
See the version list below for details.
dotnet add package NetEvolve.Logging.XUnit --version 1.1.14                
NuGet\Install-Package NetEvolve.Logging.XUnit -Version 1.1.14                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NetEvolve.Logging.XUnit" Version="1.1.14" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NetEvolve.Logging.XUnit --version 1.1.14                
#r "nuget: NetEvolve.Logging.XUnit, 1.1.14"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install NetEvolve.Logging.XUnit as a Cake Addin
#addin nuget:?package=NetEvolve.Logging.XUnit&version=1.1.14

// Install NetEvolve.Logging.XUnit as a Cake Tool
#tool nuget:?package=NetEvolve.Logging.XUnit&version=1.1.14                

NetEvolve.Logging.XUnit

This library provides a logging implementation for XUnit. When using this library, you have the ability to access the logs generated while executing your tests. This can be useful for debugging purposes.

Installation

dotnet add package NetEvolve.Logging.XUnit

Usage

You can choose to use the XUnitLogger class directly or use the AddXUnit extension method on the ILoggingBuilder instance.

Direct usage

using Microsoft.Extensions.Logging;
using NetEvolve.Logging.XUnit;
using XUnit;

public class ExampleTests
{
    private readonly ITestOutputHelper _output;

    public ExampleTests(ITestOutputHelper output)
    {
        _output = output;
    }

    [Fact]
    public void Test()
    {
        var logger = XUnitLogger.CreateLogger<ExampleTests>(_output);

        // Arrange
        ...
        // Act
        ...
        // Assert
        ...

        Assert.NotEmpty(logger.LoggedMessages);
    }
}

Usage with ILoggingBuilder.AddXUnit

Or you can use the AddXUnit extension method on the ILoggingBuilder instance.

using Microsoft.Extensions.Logging;
using NetEvolve.Logging.XUnit;

var services = new ServiceCollection();
services.AddLogging(builder =>
{
    // Add the XUnit logging implementation
    builder.AddXUnit();

    // Or alternatively with options
    builder.AddXUnit(options =>
    {
        options.TimestampFormat = "HH:mm:ss.fff";
    });
});
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on NetEvolve.Logging.XUnit:

Package Downloads
NetEvolve.Logging.Measurement

Extensions for `ILogger` implementations to measure execution times for a named scope.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.3.1 64 12/3/2024
1.2.65 814 9/11/2024
1.2.47 235 8/26/2024
1.1.14 1,054 5/30/2024
1.1.2 335 5/23/2024
1.0.0 160 5/21/2024