-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
68 changed files
with
4,714 additions
and
688 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.sh text eol=lf # linux line-endings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
Source/CDR.Register.API.Logger/CDR.Register.API.Logger.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<Version>1.1.0</Version> | ||
<FileVersion>1.1.0</FileVersion> | ||
<AssemblyVersion>1.1.0</AssemblyVersion> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.9" /> | ||
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="2.2.0" /> | ||
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" /> | ||
<PackageReference Include="Serilog.Settings.Configuration" Version="3.3.0" /> | ||
<PackageReference Include="Serilog.Sinks.MSSqlServer" Version="5.7.1" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace CDR.Register.API.Logger | ||
{ | ||
using Serilog; | ||
|
||
public interface IRequestResponseLogger | ||
{ | ||
ILogger Log { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace CDR.Register.API.Logger | ||
{ | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
public static class LoggerExtensions | ||
{ | ||
public static IServiceCollection AddRequestResponseLogging(this IServiceCollection services) | ||
{ | ||
services.AddSingleton<IRequestResponseLogger, RequestResponseLogger>(); | ||
return services; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
namespace CDR.Register.API.Logger | ||
{ | ||
using System.Diagnostics; | ||
using Microsoft.Extensions.Configuration; | ||
using Serilog; | ||
using Serilog.Core; | ||
|
||
public class RequestResponseLogger : IRequestResponseLogger, IDisposable | ||
{ | ||
private readonly Logger _logger; | ||
private readonly IConfiguration _configuration; | ||
|
||
public ILogger Log { get { return _logger; } } | ||
|
||
public RequestResponseLogger(IConfiguration configuration) | ||
{ | ||
|
||
_configuration = configuration; | ||
|
||
_logger = new LoggerConfiguration() | ||
.ReadFrom.Configuration(configuration, sectionName: "SerilogRequestResponseLogger") | ||
.Enrich.WithProperty("RequestMethod", "") | ||
.Enrich.WithProperty("RequestBody", "") | ||
.Enrich.WithProperty("RequestHeaders", "") | ||
.Enrich.WithProperty("RequestPath", "") | ||
.Enrich.WithProperty("RequestQueryString", "") | ||
.Enrich.WithProperty("StatusCode", "") | ||
.Enrich.WithProperty("ElapsedTime", "") | ||
.Enrich.WithProperty("ResponseHeaders", "") | ||
.Enrich.WithProperty("ResponseBody", "") | ||
.Enrich.WithProperty("RequestHost", "") | ||
.Enrich.WithProperty("RequestIpAddress", "") | ||
.Enrich.WithProperty("ClientId", "") | ||
.Enrich.WithProperty("SoftwareId", "") | ||
.Enrich.WithProperty("DataHolderBrandId", "") | ||
.Enrich.WithProperty("FapiInteractionId", "") | ||
.CreateLogger(); | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
Dispose(true); | ||
GC.SuppressFinalize(this); | ||
} | ||
|
||
protected virtual void Dispose(bool disposing) | ||
{ | ||
if (disposing) | ||
{ | ||
Serilog.Log.CloseAndFlush(); | ||
} | ||
|
||
} | ||
} | ||
} |
Oops, something went wrong.