Df.AuditLogging.Middleware
1.0.0.6
dotnet add package Df.AuditLogging.Middleware --version 1.0.0.6
NuGet\Install-Package Df.AuditLogging.Middleware -Version 1.0.0.6
<PackageReference Include="Df.AuditLogging.Middleware" Version="1.0.0.6" />
paket add Df.AuditLogging.Middleware --version 1.0.0.6
#r "nuget: Df.AuditLogging.Middleware, 1.0.0.6"
// Install Df.AuditLogging.Middleware as a Cake Addin #addin nuget:?package=Df.AuditLogging.Middleware&version=1.0.0.6 // Install Df.AuditLogging.Middleware as a Cake Tool #tool nuget:?package=Df.AuditLogging.Middleware&version=1.0.0.6
A framework to handle audit logging in a more consistent way
There are two packages for this purpose:
- Df.AuditLogging - for logging for correlating the audits for a request .
- Df.AuditLogging.Middleware - for hooking into the pipeline and logging the request and response.
Usage
Call pp.UseAuditLogCorrelator();
in your startup.cs or program.cs file.
And by getting the IAuditLogCorrelator
from the DI container where ever you need to audit log and calling AddAudit()
and AddAudits()
.
Source code
https://github.com/DanskeFragtmaend/Public/tree/master/src/Df.AuditLogging
Correlation
All audits in a request are put into a group with a unique ID (GUID). This ID should be saved with the audit.
X-Correlation-Id
from the HTTP header is also retrieved and saved to the last audit.
IAuditUserProvider
The IAuditUserProvider
interface is used to get the user ID for the current request. This is used to save the user ID with the audit.
A default implementation is provided with DefaultAuditUserProvider
, otherwise implement your own.
IAuditLogSource
The IAuditLogSource
interface is used to save the audits to a storage.
An implementation of this interface is provided by the consumer of this framework.
Saving the audits
IAuditLogSource.InsertAsync
is called automatically when the request is finished. This is done by the AuditLogCorrelatorMiddleware
.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
-
net6.0
- Df.AuditLogging (>= 1.0.0.16)
- Microsoft.AspNetCore.Http (>= 2.2.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.