K4ndev.Serilog 1.0.0

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

K4ndev.Serilog

NuGet .NET License

ASP.NET Core (.NET 10) üçün hazır Serilog konfiqurasiyası — Client IP, User ID, TraceId/Span, Thread məlumatları və çox gözəl konsol çıxışı ilə.


✨ Xüsusiyyətlər

  • Avtomatik Client IP (X-Forwarded-For + fallback)
  • User ID (ClaimTypes.NameIdentifier)
  • ThreadId + ThreadName
  • Span + TraceId (OpenTelemetry uyğun)
  • Yüngül və sürətli custom middleware
  • appsettings.json tam dəstək
  • Oxunaqlı və peşəkar konsol formatı
  • Sıfır konfiqurasiya ilə işləyir

🚀 Tez quraşdırma

1. Paketi əlavə edin

dotnet add package K4ndev.Serilog
2. Program.cs
C#var builder = WebApplication.CreateBuilder(args);

// Serilog-u aktiv edin
builder.Host.UseK4ndevSerilog();

var app = builder.Build();

// UserId və ClientIp üçün middleware
app.UseK4ndevLoggingMiddleware();

app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();

app.Run();
3. appsettings.json (tam nümunə)
JSON{
 "Serilog": {
    "MinimumLevel": {
      "Default": "Information",
      "Override": {
        "Microsoft": "Warning",
        "Microsoft.AspNetCore.Hosting": "Warning",
        "Microsoft.Hosting": "Information"
      }
    },
    "Filter": [
      {
        "Name": "ByExcluding",
        "Args": {
          "expression": "RequestPath like '/metrics%'"
        }
      }
    ],
    "Using": [
      "Serilog.Sinks.Console",
      "Serilog.Expressions"
    ],
    "WriteTo": [
      {
        "Name": "Console",
        "Args": {
          "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u}] [{TraceId}-{SpanId}] [{MachineName}] [User:{UserId}] [IP:{ClientIp}] ({SourceContext}) {Message:lj}{NewLine}{Exception}"
        }
      }
    ],
    "Enrich": [
      "FromLogContext",
      "WithClientIp",
      "WithThreadId",
      "WithThreadName",
      "WithSpan"
    ]
  }
}

📘 English Version
Ready-to-use Serilog setup for ASP.NET Core (.NET 10) with Client IP, User ID, TraceId/Span, Thread info and beautiful console output.
Features

Automatic Client IP detection (X-Forwarded-For support)
User ID from Claims
ThreadId + ThreadName
Span + TraceId (OpenTelemetry compatible)
Lightweight custom middleware
Full appsettings.json support
Clean and professional log format

Quick Start
Bashdotnet add package K4ndev.Serilog
C#builder.Host.UseK4ndevSerilog();
app.UseK4ndevLoggingMiddleware();

📦 Paket məlumatları

PackageId: K4ndev.Serilog
Target Framework: net10.0
License: MIT
Repository: https://github.com/k4ndev/serilog-k4ndev


👨‍💻 Müəllif
Kamran Mirzayev (k4ndev)
Baku, Azerbaijan 🇦🇿

⭐ Repo xoşunuza gəldisə ulduz verin!
Suallarınız və ya təklifləriniz varsa Issue açın.
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
1.0.0 918 2/20/2026