Arora.ApiRequestLogger 1.0.0

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

Arora.ApiRequestLogger

A lightweight, pluggable middleware to log every API call and track which routes are used the most. Built for .NET 8+.


Features

  • ✅ Logs every HTTP request route and method
  • ✅ Tracks route usage count
  • ✅ Dumps summary to a file on shutdown or manually
  • ✅ Fully customizable paths & logging behavior
  • ✅ Zero dependencies. Minimal performance impact.

Installation

dotnet add package Arora.ApiRequestLogger

Usage

1. Add Middleware

app.UseRequestLogger(new RouteLoggerOptions
{
    RouteLogPath = "logs/routes.txt",
    SummaryLogPath = "logs/summary.txt",
    EnableDetailedLogging = true
});

2. Dump Usage on App Shutdown

app.Lifetime.ApplicationStopping.Register(() =>
{
    RequestLoggingMiddleware.DumpUsageSummary(new RouteLoggerOptions
    {
        SummaryLogPath = "logs/summary.txt"
    });
});

Configuration: RouteLoggerOptions

Property Type Default Value Description
RouteLogPath string "logs/routes.txt" Path to save detailed route logs
SummaryLogPath string "logs/summary.txt" Path to dump route usage summary
EnableDetailedLogging bool true Turn on/off per-request logging

Output

  • routes.txt
    Logs each request with timestamp

    2025-05-23 14:33:01: GET /api/products
    2025-05-23 14:33:02: POST /api/login
    
  • summary.txt
    Shows how many times each route was called

    GET /api/products -> 19
    POST /api/login -> 7
    

License

MIT License – use it, remix it, Have fun ☺ BUILT WITH ♥

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.

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.0.0 113 5/23/2025