Logly 3.0.0

dotnet add package Logly --version 3.0.0                
NuGet\Install-Package Logly -Version 3.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="Logly" Version="3.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Logly --version 3.0.0                
#r "nuget: Logly, 3.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.
// 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 🚀

Build Logly Project License: MIT NuGet Version

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:

logly screenshot

🔧 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 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. 
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
3.0.0 41 2/7/2025
2.0.0 1,709 8/5/2020
1.0.2 1,905 2/27/2019
1.0.1 990 1/3/2019
1.0.0 1,116 7/2/2018

- update dependencies
           - add newer .NET version support
           - remove older targets like ASP.NET 1 and 2