Levge.AuditLog
1.0.4
See the version list below for details.
dotnet add package Levge.AuditLog --version 1.0.4
NuGet\Install-Package Levge.AuditLog -Version 1.0.4
<PackageReference Include="Levge.AuditLog" Version="1.0.4" />
<PackageVersion Include="Levge.AuditLog" Version="1.0.4" />
<PackageReference Include="Levge.AuditLog" />
paket add Levge.AuditLog --version 1.0.4
#r "nuget: Levge.AuditLog, 1.0.4"
#:package Levge.AuditLog@1.0.4
#addin nuget:?package=Levge.AuditLog&version=1.0.4
#tool nuget:?package=Levge.AuditLog&version=1.0.4
Levge.AuditLog
Levge.AuditLog is a powerful and flexible audit logging system for Entity Framework Core. It automatically tracks and logs all changes (Create, Update, Delete) to your entities, including user information, timestamps, and field-level changes. The package also supports soft delete, per-user tracking, and scheduled cleanup of old logs.
Features
- ✅ Tracks Insert, Update, Delete operations automatically
- ✅ Logs user ID, timestamp, and changed fields
- ✅ Stores both old and new values (except for Added)
- ✅ Integrates with
ICurrentUser<TKey>
from Levge.Identity - ✅ Soft delete and audit trail support via Levge.Domain
- ✅ Optional background cleanup job to remove old logs
Installation
dotnet add package Levge.AuditLog
Usage
1. Inherit from LevgeAuditDbContext<TKey>
public class MyDbContext : LevgeAuditDbContext<long> { public DbSet<Product> Products { get; set; }
public MyDbContext(DbContextOptions<MyDbContext> options, ICurrentUser<long> currentUser)
: base(options, currentUser) { }
}
2. Register in Program.cs
builder.Services.AddLevgeAuditLog<MyDbContext, long>();
3. (Optional) Enable Cleanup Job
builder.Services.AddLevgeAuditLog<MyDbContext, long>(options ⇒ { options.EnableCleanupJob = true; options.RetentionDays = 60; options.CleanupTime = new TimeOnly(3, 0); // 03:00 AM UTC });
Audit Log Table Structure
public class AuditLogEntry { public int Id { get; set; } public string TableName { get; set; } public string ObjectId { get; set; } public string Action { get; set; } public string? OriginalValues { get; set; } public string Changes { get; set; } public DateTime ChangedAt { get; set; } public object? ChangedByUserId { get; set; } }
🔗 See also:
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.1)
- Levge.Identity (>= 1.1.1)
- 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 |