PiwiTests.Instrumentation.Serilog
0.40.0
dotnet add package PiwiTests.Instrumentation.Serilog --version 0.40.0
NuGet\Install-Package PiwiTests.Instrumentation.Serilog -Version 0.40.0
<PackageReference Include="PiwiTests.Instrumentation.Serilog" Version="0.40.0" />
<PackageVersion Include="PiwiTests.Instrumentation.Serilog" Version="0.40.0" />
<PackageReference Include="PiwiTests.Instrumentation.Serilog" />
paket add PiwiTests.Instrumentation.Serilog --version 0.40.0
#r "nuget: PiwiTests.Instrumentation.Serilog, 0.40.0"
#:package PiwiTests.Instrumentation.Serilog@0.40.0
#addin nuget:?package=PiwiTests.Instrumentation.Serilog&version=0.40.0
#tool nuget:?package=PiwiTests.Instrumentation.Serilog&version=0.40.0
PiwiTests.Instrumentation.Serilog
A Serilog sink for Piwi Dashboard. WriteTo.PiwiTestLogs() feeds Warning, Error and Fatal events into the per-request capture that PiwiTests.Instrumentation.AspNetCore sends back to your Playwright tests on the X-Piwi-Logs response header.
Use it when your app logs through Serilog. With Serilog's default writeToProviders: false, Microsoft.Extensions.Logging providers are never called, so the provider AddPiwiTestLogs() registers captures nothing on its own.
Installation
dotnet add package PiwiTests.Instrumentation.AspNetCore
dotnet add package PiwiTests.Instrumentation.Serilog
This package depends on Serilog and PiwiTests.Instrumentation.Core only, not on ASP.NET Core. The middleware that writes the header comes from the ASP.NET Core package.
Usage
// Serilog configuration
loggerConfiguration.WriteTo.PiwiTestLogs();
// Startup.Configure(IApplicationBuilder app, IHostEnvironment env)
app.UsePiwiTestLogs(env, e => e.IsDevelopment() || e.IsEnvironment("Podman") || e.IsEnvironment("Integration"));
Register the sink unconditionally. It does nothing outside a request the middleware brackets, so the middleware's environment gate is the only one you need. See Choosing the environments for the ways to set it.
| Serilog level | Captured as |
|---|---|
| Verbose, Debug, Information | Not captured |
| Warning | Warning |
| Error | Error |
| Fatal | Critical |
The category is the event's SourceContext (set by ForContext<T>() and by Serilog's Microsoft.Extensions.Logging bridge), and the message is the rendered template. restrictedToMinimumLevel can raise the floor, e.g. WriteTo.PiwiTestLogs(LogEventLevel.Error); capture never goes below Warning, whatever it is set to.
Requirements
- .NET 8, 9, or 10
- Serilog 3.1.1 or later
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- PiwiTests.Instrumentation.Core (>= 0.40.0)
- Serilog (>= 3.1.1)
-
net8.0
- PiwiTests.Instrumentation.Core (>= 0.40.0)
- Serilog (>= 3.1.1)
-
net9.0
- PiwiTests.Instrumentation.Core (>= 0.40.0)
- Serilog (>= 3.1.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.