Skip to content

Commit

Permalink
- Fixes alirezavafi#1
Browse files Browse the repository at this point in the history
  • Loading branch information
bveeke authored and bveeke committed Jul 4, 2022
1 parent c4fd4f6 commit a66ea6c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Serilog.HttpClient/LoggingDelegatingHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@ public class LoggingDelegatingHandler : DelegatingHandler
private readonly ILogger _logger;

public LoggingDelegatingHandler(
RequestLoggingOptions options)
RequestLoggingOptions options,
HttpMessageHandler httpMessageHandler = default)
{
_options = options ?? throw new ArgumentNullException(nameof(options));
_logger = options.Logger?.ForContext<LoggingDelegatingHandler>() ?? Serilog.Log.Logger.ForContext<LoggingDelegatingHandler>();

InnerHandler = httpMessageHandler ?? new HttpClientHandler();
}

protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
Expand Down

0 comments on commit a66ea6c

Please sign in to comment.