LowCodeHub.Logging 0.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package LowCodeHub.Logging --version 0.0.1
                    
NuGet\Install-Package LowCodeHub.Logging -Version 0.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="LowCodeHub.Logging" Version="0.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LowCodeHub.Logging" Version="0.0.1" />
                    
Directory.Packages.props
<PackageReference Include="LowCodeHub.Logging" />
                    
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 LowCodeHub.Logging --version 0.0.1
                    
#r "nuget: LowCodeHub.Logging, 0.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 LowCodeHub.Logging@0.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=LowCodeHub.Logging&version=0.0.1
                    
Install as a Cake Addin
#tool nuget:?package=LowCodeHub.Logging&version=0.0.1
                    
Install as a Cake Tool

LowCodeHub.Logging

Production-oriented logging setup for ASP.NET Core using Serilog.

What this library gives you

  • Structured logging (console + debug + optional file sink)
  • HTTP request logging middleware
  • Correlation ID enrichment
  • Sensitive data masking support
  • Optional Application Insights sink
  • Safe request enrichment defaults (PII-conscious)
  • Forwarded headers support for reverse proxies
  • Startup validation for logging options
  • Serilog SelfLog diagnostics for sink failures

Install

dotnet add package LowCodeHub.Logging

Quick start

using LowCodeHub.Logging.Extensions;

var builder = WebApplication.CreateBuilder(args);

builder.AddEnhancedSerilogLogging(
    loggingSection: "LoggingOptions",
    telemetrySection: "TelemetryOptions");

var app = builder.Build();

app.UseHttpContextEnricher();

app.MapGet("/", () => "ok");
app.Run();
{
  "LoggingOptions": {
    "ServiceName": "orders-api",
    "MinimumLogLevel": "Information",
    "WriteToFile": true,
    "FileLogging": {
      "LogDirectory": "Logs",
      "LogFileName": "app.log",
      "RollingInterval": "Day",
      "RetainedFileCountLimit": 14,
      "SharedFile": true
    },
    "RequestEnrichment": {
      "IncludeQueryString": false,
      "IncludeAuthenticatedUser": false,
      "IncludeUserRoles": false,
      "IncludeUserAgent": true,
      "IncludeReferer": false,
      "AllowedQueryKeys": [ "page", "pageSize" ]
    },
    "ForwardedHeaders": {
      "Enabled": true,
      "ForwardLimit": 1,
      "RequireHeaderSymmetry": true,
      "KnownProxies": [ "10.0.0.10" ],
      "KnownNetworks": [ "10.244.0.0/16" ]
    },
    "SelfLog": {
      "Enabled": true,
      "WriteToConsoleError": true,
      "FilePath": "Logs/serilog-selflog.txt"
    }
  },
  "TelemetryOptions": {
    "Enabled": false,
    "ConnectionString": ""
  }
}

Best practices

  1. Set a real ServiceName per service.
  2. Keep IncludeQueryString=false unless you truly need it.
  3. If query logging is enabled, use AllowedQueryKeys allowlist only.
  4. Keep user identity fields disabled by default in public-facing APIs.
  5. Configure KnownProxies / KnownNetworks in Kubernetes or behind ingress.
  6. Enable SelfLog in production to catch sink/serialization failures.
  7. Use compact JSON logs in containerized environments.
  8. Keep file retention bounded to avoid disk exhaustion.
  9. Enable Application Insights only when you provide a valid connection string.

Application Insights

When TelemetryOptions.Enabled=true, this library registers AI telemetry and writes Serilog traces to the DI-managed TelemetryConfiguration.

Notes

  • Health endpoint logs are excluded by default (/health path filter).
  • Invalid configuration fails fast at startup.
  • UseHttpContextEnricher() should be registered early in the middleware pipeline.
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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
0.0.11 206 7/9/2026
0.0.10 152 6/21/2026
0.0.4 169 5/18/2026
0.0.3 121 5/12/2026
0.0.2 149 4/23/2026
0.0.1 154 3/26/2026