Fermion.EntityFramework.ExceptionLogs
1.0.1
dotnet add package Fermion.EntityFramework.ExceptionLogs --version 1.0.1
NuGet\Install-Package Fermion.EntityFramework.ExceptionLogs -Version 1.0.1
<PackageReference Include="Fermion.EntityFramework.ExceptionLogs" Version="1.0.1" />
<PackageVersion Include="Fermion.EntityFramework.ExceptionLogs" Version="1.0.1" />
<PackageReference Include="Fermion.EntityFramework.ExceptionLogs" />
paket add Fermion.EntityFramework.ExceptionLogs --version 1.0.1
#r "nuget: Fermion.EntityFramework.ExceptionLogs, 1.0.1"
#:package Fermion.EntityFramework.ExceptionLogs@1.0.1
#addin nuget:?package=Fermion.EntityFramework.ExceptionLogs&version=1.0.1
#tool nuget:?package=Fermion.EntityFramework.ExceptionLogs&version=1.0.1
Fermion.EntityFramework.ExceptionLogs
Fermion.EntityFramework.ExceptionLogs is a robust exception logging library for .NET applications, providing detailed tracking, filtering, and management of application exceptions. Built on top of Entity Framework Core and following clean architecture principles, it enables advanced exception analysis and operational insights.
Features
- Centralized exception logging with rich context (fingerprint, stack trace, correlation/session IDs, etc.)
- RESTful API for querying, filtering, and cleaning up exception logs
- Advanced filtering by exception type, code, log level, status code, date range, and more
- Custom middleware for global exception handling and logging
- Extensible exception handling for authentication, authorization, business, validation, and user-friendly errors
- Custom Serilog sink for forwarding logs to external systems (e.g., webhooks)
- Auditing support for creation time and user
- Automatic cleanup of old logs
Installation
dotnet add package Fermion.EntityFramework.ExceptionLogs
Project Structure
The library follows Clean Architecture principles with the following layers:
Core
- Base entities and interfaces
- Domain models (
ExceptionLog
) - Configuration options
Infrastructure
- Entity Framework Core configurations
- Database context implementations
- Repository implementations
Application
- DTOs
- Interfaces
- Services
- Mappings
Presentation
- Controllers
- API endpoints
- Request/Response models
DependencyInjection
- Service registration extensions
- Configuration options
- Middleware implementation
- Exception handling and logging
Configuration
// Register exception log services in Program.cs or Startup.cs
builder.AddFermionExceptionLogServices<ApplicationDbContext>(opt =>
{
opt.SerilogEnabled = true;
opt.ConsoleEnabled = true;
opt.FileEnabled = true;
opt.WebhookOptions.WebhookEnabled = false;
opt.WebhookOptions.WebhookUrl = "https://example.com/webhook";
opt.WebhookOptions.Method = "POST";
opt.WebhookOptions.BatchSizeLimit = 50;
opt.WebhookOptions.Period = TimeSpan.FromSeconds(5);
opt.WebhookOptions.QueueLimit = 500;
opt.WebhookOptions.RestrictedToMinimumLevel = Serilog.Events.LogEventLevel.Error;
});
// Configure DbContext
public class YourDbContext : DbContext
{
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
// Apply ExceptionLog configurations
modelBuilder.ApplyConfigurationsFromAssembly(typeof(ExceptionLogConfiguration).Assembly);
}
}
// Configure middleware in Program.cs
var app = builder.Build();
// Add exception logging middleware (should be one of the first middleware)
app.UseFermionExceptionMiddleware();
// Add other middleware
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
API Endpoints
The library provides the following RESTful API endpoints when EnableApiEndpoints
is set to true:
GET /api/exception-logs/{id}
- Get specific exception log detailsGET /api/exception-logs/pageable
- Get exception logs with filtering and paginationDELETE /api/exception-logs/cleanup
- Clean up old exception logs
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
- AutoMapper.Extensions.Microsoft.DependencyInjection (>= 12.0.1)
- Fermion.EntityFramework.Shared (>= 1.0.1)
- FluentValidation.DependencyInjectionExtensions (>= 11.11.0)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.3.0)
- Microsoft.EntityFrameworkCore (>= 9.0.3)
- Microsoft.EntityFrameworkCore.Relational (>= 9.0.3)
- Serilog (>= 4.3.0)
- Serilog.AspNetCore (>= 9.0.0)
- 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 (>= 6.0.0)
- Serilog.Sinks.File (>= 7.0.0)
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 |
---|