foundry-log 1.6.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package foundry-log --version 1.6.0
                    
NuGet\Install-Package foundry-log -Version 1.6.0
                    
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="foundry-log" Version="1.6.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="foundry-log" Version="1.6.0" />
                    
Directory.Packages.props
<PackageReference Include="foundry-log" />
                    
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 foundry-log --version 1.6.0
                    
#r "nuget: foundry-log, 1.6.0"
                    
#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 foundry-log@1.6.0
                    
#: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=foundry-log&version=1.6.0
                    
Install as a Cake Addin
#tool nuget:?package=foundry-log&version=1.6.0
                    
Install as a Cake Tool

foundry-log

HTTP request/response logging middleware for ASP.NET Core. Captures request metadata and posts it as JSON to the Foundry Log API.

Installation

Then install the package:

dotnet add package foundry-log

Usage

builder.Services.AddFoundryLog(
    service: "my-api-service",
    apiUrl: "https://test.com/v1/foundrylog",
    apiKey: "your-api-key"
);

var app = builder.Build();
app.UseFoundryLog();

All three parameters are required:

Parameter Description
service Identifies the service sending the logs
apiUrl Base URL of the Foundry Log API
apiKey API key sent via the x-api-key header

Options

builder.Services.AddFoundryLog(
    service: "my-api-service",
    apiUrl: "https://test.com/v1/foundrylog",
    apiKey: "your-api-key",
    options =>
    {
        // When true, log dispatch runs in the background and won't delay responses.
        // Use false for AWS Lambda, true for long-running hosts (IIS, Kestrel).
        // Default: false
        options.FireAndForget = true;

        // Which log levels to send. Default: Slow | Warn | Error (info is excluded).
        options.SendLevels = FoundryLogLevel.Slow | FoundryLogLevel.Warn | FoundryLogLevel.Error;

        // To include all levels:
        // options.SendLevels = FoundryLogLevel.All;

        // Duration threshold in ms for "slow" classification. Default: 1200.
        options.SlowThresholdMs = 1200;

        // HTTP status codes to ignore entirely.
        options.IgnoreStatusCodes = [404];

        // Endpoints to exclude from logging.
        // Supports exact matches and wildcard patterns.
        options.IgnoreEndpoints =
        [
            new IgnoreEndpoint("/v1/health"),                          // ignore for all levels
            new IgnoreEndpoint("/v2/*"),                               // ignore for all levels
            new IgnoreEndpoint("/swagger/*"),                          // ignore for all levels
            new IgnoreEndpoint("/v1/polls", FoundryLogLevel.Info),     // ignore only info-level logs
            new IgnoreEndpoint("/v1/feed/*",
                FoundryLogLevel.Info | FoundryLogLevel.Slow)           // ignore info and slow
        ];
    }
);

Log levels

Each request is classified into a log level:

Level Condition
error Status code 500+
warn Status code 400–499
slow Status code < 400 but duration exceeds threshold
info Status code < 400 and within threshold

By default, only slow, warn, and error logs are sent.

What gets logged

Each request produces a JSON payload sent to the Foundry Log API:

Field Description
service Service name (configured at setup)
method HTTP method (GET, POST, etc.)
hostname Host
path Request path
queryString Query string (if any)
statusCode Response status code
durationMs Request duration in milliseconds
ip Client IP address
origin Origin header
userAgent User-Agent header
platform X-Platform header (if present)
level Log level (info, slow, warn, error)
exception Exception message (if thrown)
innerException Inner exception message (if present)
requestId Unique GUID per request
timestamp UTC timestamp

Supported frameworks

  • .NET 8
  • .NET 10
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 was computed.  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.

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
1.11.0 109 6/9/2026
1.10.0 186 4/9/2026
1.9.0 134 3/30/2026
1.8.0 134 3/27/2026
1.7.0 111 3/27/2026
1.6.0 157 3/24/2026