Levge.AuditLog
1.1.41
See the version list below for details.
dotnet add package Levge.AuditLog --version 1.1.41
NuGet\Install-Package Levge.AuditLog -Version 1.1.41
<PackageReference Include="Levge.AuditLog" Version="1.1.41" />
<PackageVersion Include="Levge.AuditLog" Version="1.1.41" />
<PackageReference Include="Levge.AuditLog" />
paket add Levge.AuditLog --version 1.1.41
#r "nuget: Levge.AuditLog, 1.1.41"
#:package Levge.AuditLog@1.1.41
#addin nuget:?package=Levge.AuditLog&version=1.1.41
#tool nuget:?package=Levge.AuditLog&version=1.1.41
<img src="icon.png" width="100" height="100" alt="Levge.AuditLog logo" />
Levge.AuditLog
Levge.AuditLog
is a library that provides easy-to-use audit logging and request logging for ASP.NET Core applications using Entity Framework Core.
Features
- ✔️ Automatic audit logging for Entity Framework Core entity changes (create, update, delete).
- ✔️ Middleware for logging HTTP requests.
- ✔️ Background jobs for automatically cleaning up old logs.
- ✔️ Highly configurable through
appsettings.json
or delegate configuration. - ✔️ Generic implementation to support any primary key type.
Installation
.NET CLIdotnet add package Levge.AuditLog### Package ManagerInstall-Package Levge.AuditLog## Setup
- Inherit from
LevgeAuditDbContext<TKey>
in your application's DbContext.
public class YourDbContext : LevgeAuditDbContext<int>
{
public YourDbContext(DbContextOptions<YourDbContext> options, ICurrentUser<int> currentUser)
: base(options, currentUser)
{
}
// Your DbSets...
}
Add services to
Program.cs
.You can configure the services using
IConfiguration
(appsettings.json
) or by providing anAction
.
using Levge.AuditLog.SampleApp.Persistence; // Your DbContext namespace
using Levge.Identity.Providers; // Or your own ICurrentUser provider
var builder = WebApplication.CreateBuilder(args);
// ... other services
// Add Audit Logging
builder.Services.AddLevgeAuditLog<YourDbContext, int>(builder.Configuration);
// Or with action
// builder.Services.AddLevgeAuditLog<YourDbContext, int>(options =>
// {
// options.EnableCleanupJob = true;
// options.RetentionDays = 30;
// options.CleanupTime = new TimeOnly(2, 0, 0);
// });
// Add Request Logging
builder.Services.AddRequestLogging<YourDbContext, int>(builder.Configuration);
// Or with action
// builder.Services.AddRequestLogging<YourDbContext, int>(options =>
// {
// options.EnableCleanupJob = true;
// options.RetentionDays = 15;
// options.CleanupTime = new TimeSpan(2, 0, 0);
// });
var app = builder.Build();
// ...
// 3. Add Request Logging Middleware
app.UseRequestLogging<int>();
// ...
app.Run();
Configuration Options
AuditLogOptions
Configure these in the AuditLog
section of your appsettings.json
.
Option | Type | Description | Default |
---|---|---|---|
EnableCleanupJob |
bool |
Enables the background service to delete old audit logs. | false |
RetentionDays |
int |
Specifies how many days to keep audit logs before deleting. | 30 |
CleanupTime |
TimeOnly |
The time of day when the cleanup job should run (e.g., "02:00:00"). | 02:00 |
RequestLoggingOptions
Configure these in the RequestLogging
section of your appsettings.json
.
Option | Type | Description | Default |
---|---|---|---|
EnableCleanupJob |
bool |
Enables the background service to delete old request logs. | false |
RetentionDays |
int |
Specifies how many days to keep request logs before deleting. | 30 |
CleanupTime |
TimeSpan |
The time of day when the cleanup job should run (e.g., "02:00:00"). | 02:00 |
License
MIT License. See LICENSE 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
- Levge.Domain (>= 1.1.41)
- Levge.Identity (>= 1.1.41)
- Microsoft.EntityFrameworkCore (>= 8.0.17)
- Microsoft.EntityFrameworkCore.Relational (>= 8.0.17)
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.47 | 150 | 7/3/2025 |
1.1.46 | 145 | 7/3/2025 |
1.1.45 | 135 | 7/3/2025 |
1.1.44 | 143 | 7/3/2025 |
1.1.43 | 137 | 7/3/2025 |
1.1.42 | 140 | 7/2/2025 |
1.1.41 | 137 | 7/2/2025 |
1.0.20 | 112 | 6/21/2025 |
1.0.19 | 112 | 6/21/2025 |
1.0.18 | 108 | 6/21/2025 |
1.0.17 | 103 | 6/21/2025 |
1.0.16 | 142 | 6/19/2025 |
1.0.15 | 140 | 6/19/2025 |
1.0.13 | 142 | 6/19/2025 |
1.0.12 | 143 | 6/19/2025 |
1.0.11 | 145 | 6/19/2025 |
1.0.10 | 140 | 6/19/2025 |
1.0.9 | 139 | 6/19/2025 |
1.0.8 | 145 | 6/18/2025 |
1.0.7 | 144 | 6/18/2025 |
1.0.6 | 141 | 6/18/2025 |
1.0.5 | 147 | 6/18/2025 |
1.0.4 | 138 | 6/18/2025 |
1.0.3 | 152 | 6/18/2025 |
1.0.2 | 143 | 6/18/2025 |
1.0.0 | 150 | 6/17/2025 |