Skip to content

Commit

Permalink
Fix merge conflict.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohsen Esmailpour committed Oct 2, 2024
2 parents 2892259 + 0b9f106 commit e720fd3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 26 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# serilog-enrichers-clientinfo [![NuGet](http://img.shields.io/nuget/v/Serilog.Enrichers.ClientInfo.svg?style=flat)](https://www.nuget.org/packages/Serilog.Enrichers.ClientInfo/)
# serilog-enrichers-clientinfo [![NuGet](http://img.shields.io/nuget/v/Serilog.Enrichers.ClientInfo.svg?style=flat)](https://www.nuget.org/packages/Serilog.Enrichers.ClientInfo/) [![](https://img.shields.io/nuget/dt/Serilog.Enrichers.ClientInfo.svg?label=nuget%20downloads)](Serilog.Enrichers.ClientInfo)

Enrich logs with client IP, Correlation Id and HTTP request headers.

Install the _Serilog.Enrichers.ClientInfo_ [NuGet package](https://www.nuget.org/packages/Serilog.Enrichers.ClientInfo/)
Expand Down
23 changes: 8 additions & 15 deletions Serilog.Enrichers.ClientInfo.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,17 @@
<icon>assets\icon.png</icon>
<tags>serilog enrichers enricher ip correlation-id request header</tags>
<copyright>© 2024 Serilog Contributors</copyright>
<releaseNotes>Fix #39 - ClientIpEnricher ignores updated HttpContext.Connection.RemoteIpAddress</releaseNotes>
<releaseNotes></releaseNotes>
<dependencies>
<group targetFramework="net462">
<dependency id="Serilog" version="2.4.0" />
</group>
<group targetFramework="netstandard2.0">
<dependency id="Microsoft.AspNetCore.Http" version="2.1.1" />
<dependency id="Serilog" version="2.7.1" />
</group>
<group targetFramework="netstandard2.1">
<dependency id="Microsoft.AspNetCore.Http" version="2.2.2" />
<dependency id="Serilog" version="2.9.0" />
</group>
<group targetFramework=".NET6.0">
<dependency id="Serilog" version="2.9.0" />
</group>
<group targetFramework=".NET7.0">
<dependency id="Serilog" version="2.9.0" />
</group>
<group targetFramework=".NET8.0">
<dependency id="Serilog" version="2.9.0" />
</group>
</dependencies>
<frameworkReferences>
<group targetFramework=".NET6.0">
Expand All @@ -42,14 +34,15 @@
<group targetFramework=".NET7.0">
<frameworkReference name="Microsoft.AspNetCore.App" />
</group>
<group targetFramework=".NET8.0">
<frameworkReference name="Microsoft.AspNetCore.App" />
</group>
</frameworkReferences>
</metadata>
<files>
<file src="src\Serilog.Enrichers.ClientInfo\bin\release\netstandard2.0\Serilog.Enrichers.ClientInfo.dll" target="lib/netstandard2.0" />
<file src="src\Serilog.Enrichers.ClientInfo\bin\release\netstandard2.1\Serilog.Enrichers.ClientInfo.dll" target="lib/netstandard2.1" />
<file src="src\Serilog.Enrichers.ClientInfo\bin\release\net462\*.dll" target="lib/net462" />
<file src="src\Serilog.Enrichers.ClientInfo\bin\release\net6.0\Serilog.Enrichers.ClientInfo.dll" target="lib/net6.0" />
<file src="src\Serilog.Enrichers.ClientInfo\bin\release\net7.0\Serilog.Enrichers.ClientInfo.dll" target="lib/net7.0" />
<file src="src\Serilog.Enrichers.ClientInfo\bin\release\net8.0\Serilog.Enrichers.ClientInfo.dll" target="lib/net8.0" />
<file src="README.md" target="docs\" />
<file src="icon.png" target="assets\" />
</files>
Expand Down
2 changes: 1 addition & 1 deletion sample/SampleWebApp/SampleWebApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<ItemGroup>
<PackageReference Include="Serilog.AspNetCore" Version="5.0.0" />
<PackageReference Include="Serilog.Enrichers.ClientInfo" Version="2.0.0" />
<PackageReference Include="Serilog.Enrichers.ClientInfo" Version="2.1.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,13 @@ namespace Serilog;
public static class ClientInfoLoggerConfigurationExtensions
{
/// <summary>
/// Registers the client IP enricher to enrich logs with client IP with 'X-forwarded-for'
/// header information.
/// Registers the client IP enricher to enrich logs with <see cref="Microsoft.AspNetCore.Http.ConnectionInfo.RemoteIpAddress"/> value.
/// </summary>
/// <param name="enrichmentConfiguration">The enrichment configuration.</param>
/// <param name="headerName">
/// Set the 'X-Forwarded-For' header in case if service is behind proxy server. Default value
/// is 'x-forwarded-for'.
/// </param>
/// <exception cref="ArgumentNullException">enrichmentConfiguration</exception>
/// <returns>The logger configuration so that multiple calls can be chained.</returns>
public static LoggerConfiguration WithClientIp(
this LoggerEnrichmentConfiguration enrichmentConfiguration,
string headerName = "x-forwarded-for")
this LoggerEnrichmentConfiguration enrichmentConfiguration)
{
if (enrichmentConfiguration == null)
{
Expand Down Expand Up @@ -85,4 +79,4 @@ public static LoggerConfiguration WithRequestHeader(this LoggerEnrichmentConfigu

return enrichmentConfiguration.With(new ClientHeaderEnricher(headerName, propertyName));
}
}
}

0 comments on commit e720fd3

Please sign in to comment.