From bdf17311cf7ecd1aca90922a09f55e2755f427e6 Mon Sep 17 00:00:00 2001 From: lhaussknecht Date: Wed, 23 Nov 2016 11:14:36 +0100 Subject: [PATCH 1/2] Updated sdk to version 1.0.0-preview2-003131 --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index a2b2a415..0ac230bf 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "projects": [ "src", "test" ], "sdk": { - "version": "1.0.0-preview2-003121" + "version": "1.0.0-preview2-003131" } } From cbe2d7875c086088111f9297eb7ba32e2cd18ce2 Mon Sep 17 00:00:00 2001 From: lhaussknecht Date: Wed, 23 Nov 2016 11:15:31 +0100 Subject: [PATCH 2/2] Added IHttpClient parameter to the extension method, to allow custom HttpClients to be used. --- .../LoggerSinkConfigurationExtensions.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Serilog.Sinks.Http/LoggerSinkConfigurationExtensions.cs b/src/Serilog.Sinks.Http/LoggerSinkConfigurationExtensions.cs index 3e3c8652..d59cd099 100644 --- a/src/Serilog.Sinks.Http/LoggerSinkConfigurationExtensions.cs +++ b/src/Serilog.Sinks.Http/LoggerSinkConfigurationExtensions.cs @@ -42,19 +42,24 @@ public static class LoggerSinkConfigurationExtensions /// The minimum level for events passed through the sink. The default is /// . /// - /// Logger configuration, allowing configuration to continue. + /// + /// A custom implementation. + /// + /// Logger configuration, allowing configuration to continue. 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,