VOOZH about

URL: https://www.nuget.org/packages/Proxmea.ILoggerN/

⇱ NuGet Gallery | Proxmea.ILoggerN 1.1.5.25259


ο»Ώ

Proxmea.ILoggerN 1.1.5.25259

dotnet add package Proxmea.ILoggerN --version 1.1.5.25259
 
 
NuGet\Install-Package Proxmea.ILoggerN -Version 1.1.5.25259
 
 
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="Proxmea.ILoggerN" Version="1.1.5.25259" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Proxmea.ILoggerN" Version="1.1.5.25259" />
 
Directory.Packages.props
<PackageReference Include="Proxmea.ILoggerN" />
 
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 Proxmea.ILoggerN --version 1.1.5.25259
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Proxmea.ILoggerN, 1.1.5.25259"
 
 
#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 Proxmea.ILoggerN@1.1.5.25259
 
 
#: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=Proxmea.ILoggerN&version=1.1.5.25259
 
Install as a Cake Addin
#tool nuget:?package=Proxmea.ILoggerN&version=1.1.5.25259
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Proxmea.ILoggerN

Overview

Proxmea.ILoggerN provides a shared, configurable logging setup for .NET 8 applications using NLog, with a focus on minimal code and settings inside your project to get up running. It enables consistent, centralized logging across your application, supporting both console, file and Elastic outputs by default. It also adds missing functionality to be able to log individual properties. The package is designed for easy integration with ASP.NET Core projects and leverages dependency injection for logger access.

It's utilizing NLog as the logging provider, mainly because of its high performance.

What It Does

  • Sets up NLog as the logging provider for your .NET application. It comes with default well ironed-out layouts.
  • ILogger is missing .WithProperty, so we've implemented that here. Easy peasy to use.
  • Merges default logging configuration with your environment-specific appsettings.[environment].json. This effectivly makes your NLog section very small.
  • Allows you to retrieve and use loggers anywhere in your app, including static contexts.
  • Supports logging to both console, file and Elastic by default, with configuration overrides per environment.
  • Provides helpers for adding custom properties to log entries (e.g., application version).
  • All NLog settings are overridable in your own appsettings.json

Usage

  1. Add Controllers and Logging: In your Program.cs, add controllers and configure logging:
var builder = WebApplication.CreateBuilder(args); 
SharedLogging.ConfigureNLog(builder); 
var app = builder.Build();
  1. Initialize Logger in Static Contexts:
ServicesHelper.Configure(app.Services); 
var logger = LoggerHelper.GetLogger<Program>(); 
logger.LogInformation("Starting");
  1. Log with Custom Properties:
logger 
 .WithProperty("Version", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version) 
 .LogInformation("Application started with properties.");
  1. Controller Logging (Dependency Injection): In your controller, inject ILogger<T> and use as needed:
public class HelloWorldController : Controller 
{ 
	private readonly ILogger<HelloWorldController> _logger; 

	public HelloWorldController(ILogger<HelloWorldController> logger) 
	{ 
		_logger = logger; 
	}
	
	[HttpGet] 
	public IActionResult GetHello() { 
		_logger.LogInformation("GetHello called."); 
		return Ok("HelloBack"); 
	} 
}
  1. Configuration:
    • Default NLog settings are in Proxmea.ILoggerN.Default.AppSettings.json.

      This serves as boilerplate config for NLog.

    • Override or extend logging in your own appsettings.[environment].json.

      This is where you'd put your application specific minimal NLog config.

Sample output from HelloWorld

2025-06-11 18:41:54.2293 HelloWorld INFO HelloWorld.Program Starting
2025-06-11 18:41:54.2526 HelloWorld INFO HelloWorld.Program Environment: Production
2025-06-11 18:41:54.2553 HelloWorld INFO HelloWorld.Program Application started with properties. Version=1.0.73.25162
2025-06-11 18:41:58.5665 HelloWorld INFO HelloWorld.Controllers.HelloWorldController GetHello called. ConnectionId=0HND90RH1Q3UT, RequestId=0HND90RH1Q3UT:00000001, RequestPath=/HelloWorld, ActionId=d60d08d9-a508-4200-94ee-84a09af2dfd1, ActionName=HelloWorld.Controllers.HelloWorldController.GetHello (HelloWorld)

Changelog

Version Description
v1.1.5.25259 (2025-09-16) Added default (optional) logging of unhandled exceptions. Changed to work with non-web apps. Updated NuGets.
v1.0.62.25174 (2025-06-23) Changed Elastic layout to be async to prevent blocking the main thread on Elastic failure. Updated default console layout to colour output.
v1.0.49.251620 (2025-06-11) Initial Release

πŸ“œLicense

This project is available under a Mozilla Public License 2.0 (MPL-2.0):

  • βœ… You are free to use this project (or snippets from it) in any application, including commercial ones.
  • βœ… You must provide attribution by linking back to this repository.
  • βœ… If you modify and distribute this code, you must open-source the modified files under the same license.
  • πŸ”„ Forks and improvements are encouraged – If you enhance this project, consider submitting a pull request so everyone benefits.
  • πŸ“– Full license text: MPL-2.0

πŸ“’ Author

Developed and maintained by jrnker@Proxmea. For inquiries, issues, or contributions, check out the repository or open a pull request.

Product Versions Compatible and additional computed target framework versions.
.NET net8.0 net8.0 is compatible.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 was computed.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 was computed.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows 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.1.5.25259 438 9/16/2025
1.0.62.25174 235 6/23/2025
1.0.49.25162 358 6/11/2025