PiwiTests.Instrumentation.AspNetCore 0.22.1

dotnet add package PiwiTests.Instrumentation.AspNetCore --version 0.22.1
                    
NuGet\Install-Package PiwiTests.Instrumentation.AspNetCore -Version 0.22.1
                    
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="PiwiTests.Instrumentation.AspNetCore" Version="0.22.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PiwiTests.Instrumentation.AspNetCore" Version="0.22.1" />
                    
Directory.Packages.props
<PackageReference Include="PiwiTests.Instrumentation.AspNetCore" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PiwiTests.Instrumentation.AspNetCore --version 0.22.1
                    
#r "nuget: PiwiTests.Instrumentation.AspNetCore, 0.22.1"
                    
#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.
#:package PiwiTests.Instrumentation.AspNetCore@0.22.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PiwiTests.Instrumentation.AspNetCore&version=0.22.1
                    
Install as a Cake Addin
#tool nuget:?package=PiwiTests.Instrumentation.AspNetCore&version=0.22.1
                    
Install as a Cake Tool

PiwiTests.Instrumentation.AspNetCore

ASP.NET Core integration for Piwi Dashboard — captures Warning and Error log entries per HTTP request and delivers them to the Piwi Dashboard reporter via the X-Piwi-Logs response header.

During a Playwright test run, the reporter reads this header from every response and stores the entries alongside the network request. The entries are then available in the Piwi Dashboard test-case view and are included in the AI diagnosis context.

Active only in Development and Test environments. No header is emitted in Production.

Installation

dotnet add package PiwiTests.Instrumentation.AspNetCore

Usage

var builder = WebApplication.CreateBuilder(args);

// 1. Register the log capture provider (before Build())
builder.AddPiwiTestLogs();

var app = builder.Build();

// 2. Add the response header middleware (early in the pipeline)
app.UsePiwiTestLogs();

app.Run();

AddPiwiTestLogs() registers an ILoggerProvider that intercepts Warning and Error entries and stores them in an AsyncLocal buffer scoped to the current HTTP request.

UsePiwiTestLogs() adds middleware that serializes the buffer to JSON, gzip-compresses it, and writes the result (Base64-encoded) to the X-Piwi-Logs response header before the response is sent — but only when the environment is Development or Test.

What gets captured

Level Included
Trace No
Debug No
Information No
Warning Yes
Error Yes
Critical Yes

Each captured entry contains:

Field Description
timestamp Unix timestamp in milliseconds
level "Warning", "Error", or "Critical"
category Logger category name (e.g. MyApp.Services.OrderService)
message Formatted log message
exceptionMessage Exception message, if one was logged
StackTrace Shrunk stack trace (5 frames max, framework frames removed, namespace parts shortened to first letter)

Requirements

  • .NET 8, 9, or 10
  • Microsoft.AspNetCore.App framework reference (included automatically in ASP.NET Core projects)

How it works with Piwi Dashboard

Playwright test
  └─ page.goto('/api/orders')
       └─ ASP.NET Core handler runs
            ├─ logger.LogWarning("Stock low for {ProductId}", id)   ← captured
            └─ HTTP response
                 └─ X-Piwi-Logs: <gzip+base64 JSON>
                      └─ Piwi reporter reads header
                           └─ stored as serverLogs on the network request
                                └─ visible in test-case detail + AI diagnosis

License

MIT

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.22.1 0 7/31/2026
0.22.0 0 7/30/2026
0.21.0 33 7/30/2026
0.20.0 91 7/27/2026
0.19.0 78 7/26/2026
0.18.2 89 7/23/2026
0.18.1 89 7/23/2026
0.18.0 92 7/23/2026
0.17.0 92 7/22/2026
0.16.0 90 7/22/2026
0.15.0 96 7/19/2026
0.14.0 91 7/18/2026
0.13.0 88 7/18/2026
0.12.0 93 7/12/2026
0.11.0 96 7/11/2026
0.9.1 105 7/10/2026
0.9.0 97 7/9/2026
0.7.0 95 7/8/2026
0.6.0 99 7/2/2026
0.5.0 97 6/28/2026
Loading failed