DeltaLogs 1.1.0

dotnet add package DeltaLogs --version 1.1.0
                    
NuGet\Install-Package DeltaLogs -Version 1.1.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="DeltaLogs" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DeltaLogs" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="DeltaLogs" />
                    
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 DeltaLogs --version 1.1.0
                    
#r "nuget: DeltaLogs, 1.1.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 DeltaLogs@1.1.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=DeltaLogs&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=DeltaLogs&version=1.1.0
                    
Install as a Cake Tool

DeltaLogs

DeltaLogs is a fully automated shared logging library for ASP.NET Core Web APIs. It provides zero-configuration request/response tracking, error monitoring, and SQL query logging out of the box.

🚀 Key Features

  • Automatic Request & Response Logging: Captures HTTP Method, URL, Body, Status Code, and Duration.
  • Smart Error Handling: Automatically logs exceptions with full stack traces and classifies errors by component (Controller, Service, Repository, etc.).
  • SQL Query Monitoring: Tracks successful and failed SQL commands.
  • Zero Database Dependency: Logs are stored in a structured file system (Year → Month → Day).
  • Built-in Log Viewer: Includes an API endpoint to view logs without accessing the server files.

📦 Installation

Install the package via NuGet:

dotnet add package DeltaLogs

Or via Package Manager Console:

Install-Package DeltaLogs

🛠 Usage & Configuration (Step-by-Step)

Follow these simple steps to integrate DeltaLogs into your ASP.NET Core Web API.

Step 1: Configure AppSettings (Optional)

By default, logs are stored in wwwroot/Logs. You can customize this path in appsettings.json.

{
  "General": {
    "BasePath": "wwwroot"  // Base directory (default: wwwroot)
  },
  "LoggerPath": {
    "RelativePath": "Logs" // Sub-directory for logs (default: Logs)
  }
}

Step 2: Register Services (Program.cs)

In your Program.cs file, add the DeltaLogs services before builder.Build().

using DeltaLogs.Extensions; // Import namespace

var builder = WebApplication.CreateBuilder(args);

// ... other services ...

// Add DeltaLogs services (This registers the log viewer controller)
builder.Services.AddDeltaLogger(); 

var app = builder.Build();

Step 3: Add Middleware (Program.cs)

In the same Program.cs file, add the middleware before app.Run().

Important: Add app.UseDeltaLogger() as early as possible in the middleware pipeline (usually after UseHttpsRedirection and before MapControllers) to ensure it captures all requests.

// ... after app is built ...

app.UseHttpsRedirection();

// Enable DeltaLogs Middleware
app.UseDeltaLogger(); 

app.UseAuthorization();
app.MapControllers();

app.Run();

🗄️ SQL Logging (Optional)

To log SQL queries manually within your application (e.g., in your Dapper or ADO.NET repositories):

using DeltaLogs.SqlLogging;

// Log a successful query
SqlLogger.Add("SELECT * FROM Users WHERE Id = 1");

// Log a failed query
SqlLogger.AddFailed("INSERT INTO Logs ... (failed)");

These SQL logs will be automatically attached to the corresponding HTTP request log entry.


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 was computed.  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.
  • 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.1.0 341 2/9/2026
1.0.5 331 2/9/2026
1.0.4 329 2/9/2026
1.0.3 345 1/30/2026
1.0.2 336 1/30/2026
1.0.1 342 1/30/2026