Skip to content

Commit eb8ee58

Browse files
Remove ClientAgent enricher.
1 parent f302dd2 commit eb8ee58

File tree

3 files changed

+8
-138
lines changed

3 files changed

+8
-138
lines changed

src/Serilog.Enrichers.ClientInfo/Enrichers/ClientAgentEnricher.cs

Lines changed: 0 additions & 50 deletions
This file was deleted.

src/Serilog.Enrichers.ClientInfo/Extensions/ClientInfoLoggerConfigurationExtensions.cs

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,35 +23,22 @@ public static class ClientInfoLoggerConfigurationExtensions
2323
/// header information.
2424
/// </summary>
2525
/// <param name="enrichmentConfiguration">The enrichment configuration.</param>
26-
/// <param name="xForwardHeaderName">
26+
/// <param name="forwardHeaderName">
2727
/// Set the 'X-Forwarded-For' header in case if service is behind proxy server. Default value
28-
/// is 'X-forwarded-for'.
28+
/// is 'x-forwarded-for'.
2929
/// </param>
3030
/// <exception cref="ArgumentNullException">enrichmentConfiguration</exception>
3131
/// <returns>The logger configuration so that multiple calls can be chained.</returns>
32-
public static LoggerConfiguration WithClientIp(this LoggerEnrichmentConfiguration enrichmentConfiguration, string xForwardHeaderName = null)
33-
{
34-
if (enrichmentConfiguration == null)
35-
throw new ArgumentNullException(nameof(enrichmentConfiguration));
36-
37-
if (!string.IsNullOrEmpty(xForwardHeaderName))
38-
ClinetIpConfiguration.XForwardHeaderName = xForwardHeaderName;
39-
40-
return enrichmentConfiguration.With<ClientIpEnricher>();
41-
}
42-
43-
/// <summary>
44-
/// Registers the client Agent enricher to enrich logs with 'User-Agent' header information.
45-
/// </summary>
46-
/// <param name="enrichmentConfiguration">The enrichment configuration.</param>
47-
/// <exception cref="ArgumentNullException">enrichmentConfiguration</exception>
48-
/// <returns>The logger configuration so that multiple calls can be chained.</returns>
49-
public static LoggerConfiguration WithClientAgent(this LoggerEnrichmentConfiguration enrichmentConfiguration)
32+
public static LoggerConfiguration WithClientIp(
33+
this LoggerEnrichmentConfiguration enrichmentConfiguration,
34+
string forwardHeaderName = "x-forwarded-for")
5035
{
5136
if (enrichmentConfiguration == null)
37+
{
5238
throw new ArgumentNullException(nameof(enrichmentConfiguration));
39+
}
5340

54-
return enrichmentConfiguration.With<ClientAgentEnricher>();
41+
return enrichmentConfiguration.With(new ClientIpEnricher(forwardHeaderName));
5542
}
5643

5744
/// <summary>
@@ -87,10 +74,6 @@ public static LoggerConfiguration WithCorrelationId(
8774
/// </summary>
8875
/// <param name="enrichmentConfiguration">The enrichment configuration.</param>
8976
/// <param name="headerName">The header name to log its value</param>
90-
/// <param name="addValueIfHeaderAbsence">
91-
/// Add generated correlation id value if correlation id header not available in
92-
/// <see cref="HttpContext"/> header collection.
93-
/// </param>
9477
/// <exception cref="ArgumentNullException">enrichmentConfiguration</exception>
9578
/// <exception cref="ArgumentNullException">headerName</exception>
9679
/// <returns>The logger configuration so that multiple calls can be chained.</returns>

test/Serilog.Enrichers.ClientInfo.Tests/ClientAgentEnricherTests.cs

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)