DiagnosKit.Core
2.0.2
See the version list below for details.
dotnet add package DiagnosKit.Core --version 2.0.2
NuGet\Install-Package DiagnosKit.Core -Version 2.0.2
<PackageReference Include="DiagnosKit.Core" Version="2.0.2" />
<PackageVersion Include="DiagnosKit.Core" Version="2.0.2" />
<PackageReference Include="DiagnosKit.Core" />
paket add DiagnosKit.Core --version 2.0.2
#r "nuget: DiagnosKit.Core, 2.0.2"
#:package DiagnosKit.Core@2.0.2
#addin nuget:?package=DiagnosKit.Core&version=2.0.2
#tool nuget:?package=DiagnosKit.Core&version=2.0.2
DiagnosKit.Core
📖 Overview
DiagnosKit.Core is a reusable .NET toolkit providing cross-cutting features for your services, including:
- Global error handling middleware to capture and format unhandled exceptions.
- Centralized logger manager powered by Serilog with support for Elasticsearch and Kibana.
- Standardized error response models for consistent API output.
Designed for microservices, distributed systems, or any project that needs consistent logging, error handling, and observability.
📦 Installation
Install from NuGet:
dotnet add package DiagnosKit.Core
🚀 Quick Start
1. Register the Logger Manager
In Program.cs or Startup.ConfigureServices:
builder.Services.AddLoggerManager();
2. Configure Serilog with Elasticsearch Sink
In Program.cs (before builder.Build()):
builder.Host.ConfigureSerilogESSink();
This will:
- Read settings from
appsettings.jsonand environment-specific config. - Enrich logs with machine name, environment, correlation id, process id, and exception details.
- Write logs to Console, Debug, and Elasticsearch.
- Automatically index logs into Elasticsearch with an index format:
{service-name}-{environment}-{yyyy-MM}
3. Use the Global Error Handler
In Program.cs or Startup.Configure:
app.UseUnifiedErrorHandler();
🛠 Logging Examples
Once configured, inject the ILoggerManager into your service:
// Info
_logger.LogInfo("Application started");
// Debug
_logger.LogDebug("Processing request {RequestId}", requestId);
// Warning
_logger.LogWarn("User {UserId} attempted invalid action", userId);
// Error
_logger.LogError("Something went wrong");
_logger.LogError(exception, "Exception occurred while processing request");
All logs will be shipped to Console, Elasticsearch, and be queryable in Kibana.
Sample appsettings.json for Serilog and Elasticsearch to work as expected
{
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft.AspNetCore": "Information",
"System": "Warning"
}
}
},
"ElasticSearch": {
"Url": "http://localhost:9200",
}
}
📊 Kibana Filtering
Because logs are enriched with structured properties (like Environment, Service, CorrelationId, and Exception),
you can filter/search logs in Kibana by:
Environment: "Production"Service: "UserService"Exception existsUserId: 12345
⚖ License
This project is licensed under the MIT License - see the LICENSE file for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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 was computed. 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. net10.0 was computed. 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. |
-
net8.0
- API.Common.Response.Models (>= 1.0.2)
- Microsoft.AspNetCore.Diagnostics.Abstractions (>= 2.3.0)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.3.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.3)
- Serilog (>= 4.3.0)
- Serilog.AspNetCore (>= 8.0.0)
- Serilog.Enrichers.ClientInfo (>= 2.3.0)
- Serilog.Enrichers.CorrelationId (>= 3.0.1)
- Serilog.Enrichers.Environment (>= 3.0.1)
- Serilog.Enrichers.Process (>= 3.0.0)
- Serilog.Enrichers.Thread (>= 4.0.0)
- Serilog.Exceptions (>= 8.4.0)
- Serilog.Sinks.Console (>= 5.0.1)
- Serilog.Sinks.Debug (>= 2.0.0)
- Serilog.Sinks.Elasticsearch (>= 9.0.3)
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 |
|---|---|---|
| 2.3.1 | 279 | 10/24/2025 |
| 2.3.0 | 225 | 10/23/2025 |
| 2.2.9 | 217 | 10/12/2025 |
| 2.2.8 | 198 | 10/12/2025 |
| 2.2.7 | 227 | 10/6/2025 |
| 2.2.6 | 201 | 10/6/2025 |
| 2.2.5 | 199 | 10/6/2025 |
| 2.2.4 | 207 | 10/6/2025 |
| 2.2.3 | 210 | 10/5/2025 |
| 2.2.2 | 313 | 8/28/2025 |
| 2.2.1 | 244 | 8/28/2025 |
| 2.2.0 | 202 | 8/28/2025 |
| 2.1.3 | 134 | 8/23/2025 |
| 2.0.3 | 188 | 8/22/2025 |
| 2.0.2 | 196 | 8/22/2025 |
| 2.0.0 | 194 | 8/22/2025 |
| 1.0.0 | 211 | 8/13/2025 |
| 1.0.0-rc | 205 | 8/13/2025 |