NetEvolve.Logging.XUnit
1.3.1
dotnet add package NetEvolve.Logging.XUnit --version 1.3.1
NuGet\Install-Package NetEvolve.Logging.XUnit -Version 1.3.1
<PackageReference Include="NetEvolve.Logging.XUnit" Version="1.3.1" />
paket add NetEvolve.Logging.XUnit --version 1.3.1
#r "nuget: NetEvolve.Logging.XUnit, 1.3.1"
// Install NetEvolve.Logging.XUnit as a Cake Addin #addin nuget:?package=NetEvolve.Logging.XUnit&version=1.3.1 // Install NetEvolve.Logging.XUnit as a Cake Tool #tool nuget:?package=NetEvolve.Logging.XUnit&version=1.3.1
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 | Versions 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. net9.0 is compatible. |
-
net6.0
- Microsoft.Bcl.TimeProvider (>= 9.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Logging.Configuration (>= 9.0.0)
- NetEvolve.Arguments (>= 1.2.168)
- NetEvolve.Logging.Abstractions (>= 1.2.0)
- xunit.extensibility.core (>= 2.9.2)
- xunit.extensibility.execution (>= 2.9.2)
-
net7.0
- Microsoft.Bcl.TimeProvider (>= 9.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Logging.Configuration (>= 9.0.0)
- NetEvolve.Arguments (>= 1.2.168)
- NetEvolve.Logging.Abstractions (>= 1.2.0)
- xunit.extensibility.core (>= 2.9.2)
- xunit.extensibility.execution (>= 2.9.2)
-
net8.0
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Logging.Configuration (>= 9.0.0)
- NetEvolve.Arguments (>= 1.2.168)
- NetEvolve.Logging.Abstractions (>= 1.2.0)
- xunit.extensibility.core (>= 2.9.2)
- xunit.extensibility.execution (>= 2.9.2)
-
net9.0
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Logging.Configuration (>= 9.0.0)
- NetEvolve.Arguments (>= 1.2.168)
- NetEvolve.Logging.Abstractions (>= 1.2.0)
- xunit.extensibility.core (>= 2.9.2)
- xunit.extensibility.execution (>= 2.9.2)
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.