DynamicLogger 1.0.1

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

DynamicLogger

A modern, minimal, and dynamic logging library for ASP.NET Core and .NET applications. Easily manage and change log levels at runtime for fine-grained logging control.

Features

  • Dynamic log level adjustment for categories via API endpoint or code.
  • Minimal API ready extension for fast integration.
  • Configurable via swagger-exposed endpoints.
  • Supports Microsoft.Extensions.Logging abstractions.

Getting Started

1. Install via NuGet

dotnet add package DynamicLogger

2. Register Services

In your Program.cs or Startup.cs:

// Register DynamicLogger services
builder.Services.AddLoggerServices();

3. Add DynamicLogger Endpoint

For Minimal API:

app.MapLoggerEndpoint();

Example:
Sets log level for the default category:

POST /logging/setlevel/{level}
Body: { "level": "Information" }

Usage Example

// Change log level for category
DynamicLogger.SetLogLevel("Default", LogLevel.Debug);

Swagger Integration

Endpoints added via your library are auto-detected by Swagger/OpenAPI:

builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();

app.MapLoggerEndpoint();

app.UseSwagger();
app.UseSwaggerUI();

API Reference

Get All Log Categories

GET /logging/categories

Returns all log categories currently tracked.


Set Log Level for 'Default' Category

POST /logging/setlevel/{level}

level: Trace, Debug, Information, Warning, Error, Critical, None. Sets log level for the 'Default' category.


Set Log Level for All Non-System Categories

POST /logging/set-nonsystem-level/{level}

level: Same as above Sets log level for all non-system (application-specific) categories.


Set Log Level for a Specific Category

POST /logging/set-category-level/{category}/{level}

category: Log category name level: Log level Sets log level for a specified category.


Set Log Level for All Categories with Prefix

POST /logging/set-prefix-level/{prefix}/{level}

prefix: Prefix string level: Log level Sets log level for all categories starting with the given prefix.


Set Log Level with Custom Path

POST {path}/setlevel/{level}

path: Custom route prefix level: Log level Allows endpoint customization for setting default log level.


Allowed Log Levels: Trace, Debug, Information, Warning, Error, Critical, None


License

MIT


Author

Created by IoJo


Product Compatible and additional computed target framework versions.
.NET 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 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.1 841 11/10/2025
1.0.0 169 11/6/2025