Skip to content

Commit

Permalink
feat: add support for ignoring flush on dispose (#366)
Browse files Browse the repository at this point in the history
  • Loading branch information
FantasticFiasco committed Apr 14, 2024
1 parent faa2df8 commit e40602a
Show file tree
Hide file tree
Showing 30 changed files with 635 additions and 220 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ csharp_new_line_before_members_in_anonymous_types = true
[*.csproj]
indent_size = 2

[*.js]
indent_size = 2

[*.json]
indent_size = 2

Expand Down
27 changes: 24 additions & 3 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,27 @@ jobs:
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
# - run: dotnet build -c Release
# - run: dotnet test -c Release --no-build
- run: build\build2.ps1
- run: scripts\build.ps1
- uses: actions/upload-artifact@v4
with:
name: nuget
path: artifacts
if-no-files-found: 'error'

release:
needs: build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
- uses: actions/download-artifact@v4
with:
name: nuget
path: artifacts
- run: dotnet nuget push .\artifacts\*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}
- uses: actions/github-script@v7
with:
script: |
const script = require('./scripts/create-release.js')
script({github, context})
19 changes: 16 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,26 @@ This project adheres to [Semantic Versioning](http://semver.org/) and is followi

## Unreleased

## [9.0.0-beta.2] - 2024-03-27

### :zap: Added

- Support for .NET Framework 4.6.2
- [#262](https://github.com/FantasticFiasco/serilog-sinks-http/issues/262) [BREAKING CHANGE] Support specifying `flushOnClose` when creating the sink, thus adding the support to suppress sending unsent log events to the log server before closing the sink (proposed by [@murlidakhare](https://github.com/murlidakhare), [@julichan](https://github.com/julichan), [@janichirag11](https://github.com/janichirag11) & [@prasadpaul53](https://github.com/prasadpaul53))

**Migration guide**

The parameter `flushOnClose` has been introduced to the methods `Http`, `DurableHttpUsingFileSizeRolledBuffers` and `DurableHttpUsingTimeRolledBuffers`. Please verify that the arguments pass by you to these methods still align with your intentions.

To automatically mitigate this kind of *new parameter issue* in the future, move from using positional arguments to named arguments.

### :dizzy: Changed

- [#262](https://github.com/FantasticFiasco/serilog-sinks-http/issues/262) [BREAKING CHANGE] A new argument of type `CancellationToken` has been added to the `PostAsync` method of interface `IHttpClient`.

### :skull: Removed

- [BREAKING CHANGE] Remove support for .NET Framework 4.5, aligning with the [.NET Framework support policy](https://learn.microsoft.com/lifecycle/products/microsoft-net-framework)
- [#253](https://github.com/FantasticFiasco/serilog-sinks-http/issues/253) [BREAKING CHANGE] Remove support for .NET Framework 4.5, aligning with the [.NET Framework support policy](https://learn.microsoft.com/lifecycle/products/microsoft-net-framework)
- [BREAKING CHANGE] Remove support for .NET Framework 4.6.1, aligning with the [.NET Framework support policy](https://learn.microsoft.com/lifecycle/products/microsoft-net-framework)

## [9.0.0-beta.1] - 2023-04-12
Expand All @@ -25,7 +38,7 @@ This project adheres to [Semantic Versioning](http://semver.org/) and is followi

The parameter `levelSwitch` has been introduced to the methods `Http`, `DurableHttpUsingFileSizeRolledBuffers` and `DurableHttpUsingTimeRolledBuffers`. Please verify that the arguments pass by you to these methods still align with your intentions.

To automatically mitigate this kind of *new parameter issue* in the future, move from using positional arguments to named arguments instead.
To automatically mitigate this kind of *new parameter issue* in the future, move from using positional arguments to named arguments.

## [8.0.0] - 2022-04-10

Expand All @@ -37,7 +50,7 @@ This project adheres to [Semantic Versioning](http://semver.org/) and is followi

The parameter `batchSizeLimitBytes` has been introduced to the methods `Http`, `DurableHttpUsingFileSizeRolledBuffers` and `DurableHttpUsingTimeRolledBuffers`. Please verify that the arguments pass by you to these methods still align with your intentions.

To automatically mitigate this kind of *new parameter issue* in the future, move from using positional arguments to named arguments instead.
To automatically mitigate this kind of *new parameter issue* in the future, move from using positional arguments to named arguments.

- [#166](https://github.com/FantasticFiasco/serilog-sinks-http/issues/166) Support for content encoding [Gzip](https://en.wikipedia.org/wiki/Gzip) using HTTP client `JsonGzipHttpClient` (contribution by [@vaibhavepatel](https://github.com/vaibhavepatel), [@KalininAndreyVictorovich](https://github.com/KalininAndreyVictorovich) and [@AntonSmolkov](https://github.com/AntonSmolkov))
- [#166](https://github.com/FantasticFiasco/serilog-sinks-http/issues/166) Support for specifying `HttpClient` when creating `JsonHttpClient` and `JsonGzipHttpClient`
Expand Down
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

<PropertyGroup>
<VersionPrefix>9.0.0</VersionPrefix>
<VersionSuffix>beta.1</VersionSuffix>
<VersionSuffix>beta.2</VersionSuffix>
<Authors>Mattias Kindborg</Authors>
<Copyright>Copyright 2015-2024 Serilog Contributors</Copyright>
<Company />
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<NoWarn>1591;NU5105</NoWarn>
</PropertyGroup>

</Project>
</Project>
38 changes: 0 additions & 38 deletions appveyor.yml

This file was deleted.

103 changes: 0 additions & 103 deletions build/build.ps1

This file was deleted.

File renamed without changes.
36 changes: 36 additions & 0 deletions scripts/create-release.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
const fs = require("fs").promises;
const path = require("path");

const ARTIFACTS_PATH = "./artifacts";

const createRelease = async ({github, context}) => {
const owner = context.repo.owner;
const repo = context.repo.repo;
const tag_name = context.ref.replace(/refs\/tags\//, '');

const res = await github.rest.repos.createRelease({
owner,
repo,
tag_name,
name: "Release " + tag_name,
body: "TODO",
draft: true,
});

const artifacts = await fs.readdir(ARTIFACTS_PATH);

for (let artifact of artifacts) {
const artifactPath = path.join(ARTIFACTS_PATH, artifact);
const data = await fs.readFile(artifactPath);

await github.rest.repos.uploadReleaseAsset({
owner,
repo,
release_id: res.data.id,
name: artifact,
data
});
}
}

module.exports = createRelease;
12 changes: 11 additions & 1 deletion serilog-sinks-http.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Serilog.Sinks.Http", "src\S
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Serilog.Sinks.HttpTests", "test\Serilog.Sinks.HttpTests\Serilog.Sinks.HttpTests.csproj", "{C61C3037-87DB-4756-BAE5-282944FC931C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Serilog.Sinks.HttpTests.LogServer", "test\Serilog.Sinks.HttpTests.LogServer\Serilog.Sinks.HttpTests.LogServer.csproj", "{85C26BFC-6563-4330-8B29-CAA5C4EF5393}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Serilog.Sinks.HttpTests.LogServer", "test\Serilog.Sinks.HttpTests.LogServer\Serilog.Sinks.HttpTests.LogServer.csproj", "{85C26BFC-6563-4330-8B29-CAA5C4EF5393}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "locked-bookmark-file", "locked-bookmark-file", "{6340BAF6-039B-4589-A614-E6DECA729664}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "producer", "test\locked-bookmark-file\producer\producer.csproj", "{C1999944-6987-43B1-9E4B-2A1DC0B4D97C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -31,6 +35,10 @@ Global
{85C26BFC-6563-4330-8B29-CAA5C4EF5393}.Debug|Any CPU.Build.0 = Debug|Any CPU
{85C26BFC-6563-4330-8B29-CAA5C4EF5393}.Release|Any CPU.ActiveCfg = Release|Any CPU
{85C26BFC-6563-4330-8B29-CAA5C4EF5393}.Release|Any CPU.Build.0 = Release|Any CPU
{C1999944-6987-43B1-9E4B-2A1DC0B4D97C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C1999944-6987-43B1-9E4B-2A1DC0B4D97C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C1999944-6987-43B1-9E4B-2A1DC0B4D97C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C1999944-6987-43B1-9E4B-2A1DC0B4D97C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -39,6 +47,8 @@ Global
{5E451D5E-FA01-47F0-9D6F-45C8D98D9D19} = {DB19D3CD-BF05-45EA-97D8-FC9F64BF0B7B}
{C61C3037-87DB-4756-BAE5-282944FC931C} = {9C45525E-C6CE-43B4-95A6-11198A27F4BE}
{85C26BFC-6563-4330-8B29-CAA5C4EF5393} = {9C45525E-C6CE-43B4-95A6-11198A27F4BE}
{6340BAF6-039B-4589-A614-E6DECA729664} = {9C45525E-C6CE-43B4-95A6-11198A27F4BE}
{C1999944-6987-43B1-9E4B-2A1DC0B4D97C} = {6340BAF6-039B-4589-A614-E6DECA729664}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F8A6D01E-9C56-4B8F-93B5-8A1D7F693340}
Expand Down
Loading

0 comments on commit e40602a

Please sign in to comment.