Skip to content

Commit

Permalink
removed: deprecated extension DurableHttp (#183)
Browse files Browse the repository at this point in the history
Closes #182
  • Loading branch information
FantasticFiasco authored Apr 5, 2021
1 parent cdca391 commit e5b38d7
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 133 deletions.
60 changes: 56 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ log = new LoggerConfiguration()
false,
10,
500,
TimeSpan.FromSeconds(10)
TimeSpan.FromSeconds(10))
.CreateLogger();

// After migration
Expand All @@ -57,7 +57,7 @@ log = new LoggerConfiguration()
retainedBufferFileCountLimit: 10,
batchPostingLimit: 500,
// the new argument batchSizeLimitBytes is positioned here
period: TimeSpan.FromSeconds(10)
period: TimeSpan.FromSeconds(10))
.CreateLogger();
```

Expand All @@ -73,7 +73,7 @@ log = new LoggerConfiguration()
false,
10,
500,
TimeSpan.FromSeconds(10)
TimeSpan.FromSeconds(10))
.CreateLogger();

// After migration
Expand All @@ -86,7 +86,7 @@ log = new LoggerConfiguration()
retainedBufferFileCountLimit: 10,
batchPostingLimit: 500,
// the new argument batchSizeLimitBytes is positioned here
period: TimeSpan.FromSeconds(10)
period: TimeSpan.FromSeconds(10))
.CreateLogger();
```

Expand Down Expand Up @@ -133,6 +133,58 @@ public class MyHttpClient : IHttpClient
}
```

### :skull: Removed

- [#182](https://github.com/FantasticFiasco/serilog-sinks-http/issues/182) Extension method `DurableHttp` which was marked as deprecated in v5.2.0

**Migration guide**

Given you are configuring the sink in code you should do the following changes.

```csharp
// Before migration
log = new LoggerConfiguration()
.WriteTo.DurableHttp(requestUri: "http://www.mylogs.com")
.CreateLogger();

// After migration
log = new LoggerConfiguration()
.WriteTo.DurableHttpUsingTimeRolledBuffers(requestUri: "http://www.mylogs.com")
.CreateLogger();
```

Given you are configuring the sink in application configuration you should do the following changes.

```json
// Before migration
{
"Serilog": {
"WriteTo": [
{
"Name": "DurableHttp",
"Args": {
"requestUri": "http://www.mylogs.com"
}
}
]
}
}

// After migration
{
"Serilog": {
"WriteTo": [
{
"Name": "DurableHttpUsingTimeRolledBuffers",
"Args": {
"requestUri": "http://www.mylogs.com"
}
}
]
}
}
```

### :syringe: Fixed

- Durable buffer files are no longer created with an initial [BOM](https://en.wikipedia.org/wiki/Byte_order_mark)
Expand Down
34 changes: 0 additions & 34 deletions src/Serilog.Sinks.Http/LoggerSinkConfigurationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// limitations under the License.

using System;
using System.ComponentModel;
using Microsoft.Extensions.Configuration;
using Serilog.Configuration;
using Serilog.Events;
Expand Down Expand Up @@ -127,39 +126,6 @@ public static LoggerConfiguration Http(
return sinkConfiguration.Sink(sink, restrictedToMinimumLevel);
}

[Obsolete("Use DurableHttpUsingTimeRolledBuffers instead of this sink provider")]
[EditorBrowsable(EditorBrowsableState.Never)]
public static LoggerConfiguration DurableHttp(
this LoggerSinkConfiguration sinkConfiguration,
string requestUri,
string bufferPathFormat = "Buffer-{Date}.json",
long? bufferFileSizeLimitBytes = null,
bool bufferFileShared = false,
int? retainedBufferFileCountLimit = 31,
int batchPostingLimit = 1000,
TimeSpan? period = null,
ITextFormatter? textFormatter = null,
IBatchFormatter? batchFormatter = null,
LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum,
IHttpClient? httpClient = null,
IConfiguration? configuration = null)
{
return DurableHttpUsingTimeRolledBuffers(
sinkConfiguration: sinkConfiguration,
requestUri: requestUri,
bufferPathFormat: bufferPathFormat,
bufferFileSizeLimitBytes: bufferFileSizeLimitBytes,
bufferFileShared: bufferFileShared,
retainedBufferFileCountLimit: retainedBufferFileCountLimit,
batchPostingLimit: batchPostingLimit,
period: period,
textFormatter: textFormatter,
batchFormatter: batchFormatter,
restrictedToMinimumLevel: restrictedToMinimumLevel,
httpClient: httpClient,
configuration: configuration);
}

/// <summary>
/// Adds a durable sink that sends log events using HTTP POST over the network. A durable
/// sink will persist log events on disk in buffer files before sending them over the
Expand Down

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions test/Serilog.Sinks.HttpTests/Serilog.Sinks.HttpTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@
<None Update="appsettings_durable_http_using_time_rolled_buffers.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="appsettings_durable_http.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="appsettings_http.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
23 changes: 0 additions & 23 deletions test/Serilog.Sinks.HttpTests/appsettings_durable_http.json

This file was deleted.

0 comments on commit e5b38d7

Please sign in to comment.