Logly 3.0.0
dotnet add package Logly --version 3.0.0
NuGet\Install-Package Logly -Version 3.0.0
<PackageReference Include="Logly" Version="3.0.0" />
paket add Logly --version 3.0.0
#r "nuget: Logly, 3.0.0"
// Install Logly as a Cake Addin #addin nuget:?package=Logly&version=3.0.0 // Install Logly as a Cake Tool #tool nuget:?package=Logly&version=3.0.0
logly 🚀
This work is based on that done by Casey MacPherson here.
logly is a powerful library for ASP.NET Core that makes request and response logging more modular and visually appealing. 📝✨
📸 Example Output
Here's an example of what logly logging looks like:
🔧 Prerequisites
To prevent default logging by ASP.NET Core, you need to modify the BuildWebHost
method.
Before:
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.Build();
After:
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.ConfigureLogging((context, logging) =>
{
logging.ClearProviders();
})
.UseStartup<Startup>()
.Build();
🚀 Setup
To enable logging, you have two options:
✅ Simple Setup
Just add the following line to the Configure
method in the Startup.cs
file:
app.UseLogly();
This enables basic logging for:
- Request Method 📝
- Response Status Code ✅
- Response Time ⏱️
⚙️ Advanced Setup
For more control, use LoggerOptionsBuilder
to specify logging options:
app.UseLogly(opts => opts
.AddRequestMethod() // Logs HTTP method (GET, POST, etc.)
.AddStatusCode() // Logs response status codes (200, 404, etc.)
.AddResponseTime() // Logs response time in milliseconds
.AddUrl() // Logs request URL
.AddResponseLength() // Logs response size in bytes
.AddIgnoreUrls("/health", "/metrics")); // Ignore specific URLs
🛠️ New Feature: Ignore Specific URLs
You can now specify a list of URL patterns to ignore using AddIgnoreUrls
. This is useful for skipping logging on health checks, monitoring endpoints, or other unnecessary logs.
app.UseLogly(opts => opts.AddIgnoreUrls("/health", "/metrics", "/swagger/*"));
- Supports glob patterns for flexibility (e.g.,
/swagger/*
ignores all Swagger routes).
🚀 logly makes logging clean, structured, and easy to use. Give it a try and streamline your ASP.NET Core logging today! 🚀
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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. |
.NET Core | netcoreapp3.1 is compatible. |
-
.NETCoreApp 3.1
- Microsoft.AspNetCore.Http.Abstractions (>= 2.3.0)
-
net5.0
- Microsoft.AspNetCore.Http.Abstractions (>= 2.3.0)
-
net6.0
- Microsoft.AspNetCore.Http.Abstractions (>= 2.3.0)
-
net7.0
- Microsoft.AspNetCore.Http.Abstractions (>= 2.3.0)
-
net8.0
- Microsoft.AspNetCore.Http.Abstractions (>= 2.3.0)
-
net9.0
- Microsoft.AspNetCore.Http.Abstractions (>= 2.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
- update dependencies
- add newer .NET version support
- remove older targets like ASP.NET 1 and 2