NetEvolve.Logging.XUnit
1.2.65
dotnet add package NetEvolve.Logging.XUnit --version 1.2.65
NuGet\Install-Package NetEvolve.Logging.XUnit -Version 1.2.65
<PackageReference Include="NetEvolve.Logging.XUnit" Version="1.2.65" />
paket add NetEvolve.Logging.XUnit --version 1.2.65
#r "nuget: NetEvolve.Logging.XUnit, 1.2.65"
// Install NetEvolve.Logging.XUnit as a Cake Addin #addin nuget:?package=NetEvolve.Logging.XUnit&version=1.2.65 // Install NetEvolve.Logging.XUnit as a Cake Tool #tool nuget:?package=NetEvolve.Logging.XUnit&version=1.2.65
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. |
-
net6.0
- Microsoft.Bcl.TimeProvider (>= 8.0.1)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Logging.Configuration (>= 8.0.0)
- NetEvolve.Arguments (>= 1.2.90)
- NetEvolve.Logging.Abstractions (>= 1.1.70)
- xunit.extensibility.core (>= 2.9.0)
- xunit.extensibility.execution (>= 2.9.0)
-
net7.0
- Microsoft.Bcl.TimeProvider (>= 8.0.1)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Logging.Configuration (>= 8.0.0)
- NetEvolve.Arguments (>= 1.2.90)
- NetEvolve.Logging.Abstractions (>= 1.1.70)
- xunit.extensibility.core (>= 2.9.0)
- xunit.extensibility.execution (>= 2.9.0)
-
net8.0
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Logging.Configuration (>= 8.0.0)
- NetEvolve.Arguments (>= 1.2.90)
- NetEvolve.Logging.Abstractions (>= 1.1.70)
- xunit.extensibility.core (>= 2.9.0)
- xunit.extensibility.execution (>= 2.9.0)
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.