Skip to content

Commit

Permalink
Merge pull request #1 from lhaussknecht/custom_http_client
Browse files Browse the repository at this point in the history
Allow custom http clients
  • Loading branch information
FantasticFiasco authored Nov 23, 2016
2 parents b68d0f6 + cbe2d78 commit ac3b8bb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-preview2-003121"
"version": "1.0.0-preview2-003131"
}
}
11 changes: 8 additions & 3 deletions src/Serilog.Sinks.Http/LoggerSinkConfigurationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,24 @@ public static class LoggerSinkConfigurationExtensions
/// The minimum level for events passed through the sink. The default is
/// <see cref="LevelAlias.Minimum"/>.
/// </param>
/// <returns>Logger configuration, allowing configuration to continue.</returns>
/// <param name="httpClient">
/// A custom <see cref="IHttpClient"/> implementation.
/// </param>
/// <returns>Logger configuration, allowing configuration to continue.</returns>
public static LoggerConfiguration Http(
this LoggerSinkConfiguration sinkConfiguration,
string requestUri,
int? batchPostingLimit = null,
TimeSpan? period = null,
IFormatProvider formatProvider = null,
LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum)
LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum,
IHttpClient httpClient = null)
{
if (sinkConfiguration == null)
throw new ArgumentNullException(nameof(sinkConfiguration));

var client = new HttpClientWrapper();
var client = httpClient ?? new HttpClientWrapper();

var sink = new HttpSink(
client,
requestUri,
Expand Down

0 comments on commit ac3b8bb

Please sign in to comment.