Skip to content

Commit

Permalink
Merge pull request #14 from skoruba/release/1.1.0
Browse files Browse the repository at this point in the history
Release/1.1.0
  • Loading branch information
skoruba authored Jan 18, 2023
2 parents 1982a75 + babc50a commit 5d313fb
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 19 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
# 🕊️ Skoruba.AuditLogging
> Simple audit logging for .NET Core with EntityFramework Core support
**This project is ported to .NET Core 3.1.** 🚀
**This project is ported to .NET 6.** 🚀

# How to install

```ps
dotnet add package Skoruba.AuditLogging.EntityFramework --version 1.0.0
dotnet add package Skoruba.AuditLogging.EntityFramework --version 1.1.0
```

# How to use it
Expand All @@ -18,6 +18,7 @@ dotnet add package Skoruba.AuditLogging.EntityFramework --version 1.0.0
```csharp
services.AddAuditLogging(options =>
{
options.Enabled = true;
options.UseDefaultSubject = true;
options.UseDefaultAction = true;
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Version>1.0.0</Version>
<TargetFramework>net6.0</TargetFramework>
<Version>1.1.0</Version>
<Description>Simple audit logging for .NET Core with EntityFramework Core support</Description>
<PackageProjectUrl></PackageProjectUrl>
<RepositoryUrl>https://github.com/skoruba/AuditLogging</RepositoryUrl>
Expand All @@ -14,7 +14,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
14 changes: 5 additions & 9 deletions src/Skoruba.AuditLogging.Host/Skoruba.AuditLogging.Host.csproj
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<UserSecretsId>5cc61b65-f1d1-4aa9-be20-fbf67d81e116</UserSecretsId>
</PropertyGroup>

<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.1">
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/Skoruba.AuditLogging.Host/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public void ConfigureServices(IServiceCollection services)

services.AddAuditLogging(options =>
{
options.Enabled = true;
options.UseDefaultAction = true;
options.UseDefaultSubject = true;
options.Source = typeof(Program).Assembly.GetName().Name;
Expand Down
6 changes: 6 additions & 0 deletions src/Skoruba.AuditLogging/Configuration/AuditLoggerOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
{
public class AuditLoggerOptions
{

public bool Enabled { get; set; } = true;

/// <summary>
/// Name of source
/// </summary>
public string Source { get; set; }

/// <summary>
Expand Down
5 changes: 5 additions & 0 deletions src/Skoruba.AuditLogging/Services/AuditEventLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ private void PrepareDefaultSubject(AuditEvent auditEvent)
/// <returns></returns>
public virtual async Task LogEventAsync(AuditEvent auditEvent, Action<AuditLoggerOptions> loggerOptions = default)
{
if (!_auditLoggerOptions.Enabled)
{
return;
}

await PrepareEventAsync(auditEvent, loggerOptions);

foreach (var sink in Sinks)
Expand Down
10 changes: 5 additions & 5 deletions src/Skoruba.AuditLogging/Skoruba.AuditLogging.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Version>1.0.0</Version>
<TargetFramework>net6.0</TargetFramework>
<Version>1.1.0</Version>
<Description>Simple audit logging for .NET Core with EntityFramework Core support</Description>
<PackageProjectUrl></PackageProjectUrl>
<RepositoryUrl>https://github.com/skoruba/AuditLogging</RepositoryUrl>
Expand All @@ -25,9 +25,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.1.1" />
<PackageReference Include="Microsoft.Extensions.Primitives" Version="3.1.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Primitives" Version="6.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>

</Project>

0 comments on commit 5d313fb

Please sign in to comment.