Skip to content

Commit 744f6fd

Browse files
authored
Merge pull request #90 from serilog-contrib/dev
Create 7.0 Release
2 parents 39fe200 + 87a25d7 commit 744f6fd

39 files changed

+730
-598
lines changed

.editorconfig

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,91 @@ end_of_line = lf
1414

1515
[*.{cmd, bat}]
1616
end_of_line = crlf
17+
18+
[*.cs]
19+
20+
#Core editorconfig formatting - indentation
21+
22+
#use soft tabs (spaces) for indentation
23+
indent_style = space
24+
25+
#Formatting - new line options
26+
27+
#place catch statements on a new line
28+
csharp_new_line_before_catch = true
29+
#place else statements on a new line
30+
csharp_new_line_before_else = true
31+
#require finally statements to be on a new line after the closing brace
32+
csharp_new_line_before_finally = true
33+
#require braces to be on a new line for methods, control_blocks, types, object_collection, and properties (also known as "Allman" style)
34+
csharp_new_line_before_open_brace = methods, control_blocks, types, object_collection, properties
35+
36+
#Formatting - organize using options
37+
38+
#sort System.* using directives alphabetically, and place them before other usings
39+
dotnet_sort_system_directives_first = true
40+
41+
#Formatting - spacing options
42+
43+
#require NO space between a cast and the value
44+
csharp_space_after_cast = false
45+
#require a space before the colon for bases or interfaces in a type declaration
46+
csharp_space_after_colon_in_inheritance_clause = true
47+
#require a space after a keyword in a control flow statement such as a for loop
48+
csharp_space_after_keywords_in_control_flow_statements = true
49+
#require a space before the colon for bases or interfaces in a type declaration
50+
csharp_space_before_colon_in_inheritance_clause = true
51+
#remove space within empty argument list parentheses
52+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
53+
#remove space between method call name and opening parenthesis
54+
csharp_space_between_method_call_name_and_opening_parenthesis = false
55+
#do not place space characters after the opening parenthesis and before the closing parenthesis of a method call
56+
csharp_space_between_method_call_parameter_list_parentheses = false
57+
#remove space within empty parameter list parentheses for a method declaration
58+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
59+
#place a space character after the opening parenthesis and before the closing parenthesis of a method declaration parameter list.
60+
csharp_space_between_method_declaration_parameter_list_parentheses = false
61+
62+
#Formatting - wrapping options
63+
64+
#leave code block on single line
65+
csharp_preserve_single_line_blocks = true
66+
#leave statements and member declarations on the same line
67+
csharp_preserve_single_line_statements = true
68+
69+
#Style - expression bodied member options
70+
71+
#prefer expression-bodied members for accessors
72+
csharp_style_expression_bodied_accessors = true:suggestion
73+
#prefer block bodies for methods
74+
csharp_style_expression_bodied_methods = false:suggestion
75+
#prefer expression-bodied members for properties
76+
csharp_style_expression_bodied_properties = true:suggestion
77+
78+
#Style - expression level options
79+
80+
#prefer out variables to be declared inline in the argument list of a method call when possible
81+
csharp_style_inlined_variable_declaration = true:suggestion
82+
#prefer the language keyword for member access expressions, instead of the type name, for types that have a keyword to represent them
83+
dotnet_style_predefined_type_for_member_access = true:suggestion
84+
85+
#Style - implicit and explicit types
86+
87+
#prefer var is used to declare variables with built-in system types such as int
88+
csharp_style_var_for_built_in_types = true:suggestion
89+
#prefer var when the type is already mentioned on the right-hand side of a declaration expression
90+
csharp_style_var_when_type_is_apparent = true:suggestion
91+
92+
#Style - language keyword and framework type options
93+
94+
#prefer the language keyword for local variables, method parameters, and class members, instead of the type name, for types that have a keyword to represent them
95+
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
96+
97+
#Style - qualification options
98+
99+
#prefer fields not to be prefaced with this. or Me. in Visual Basic
100+
dotnet_style_qualification_for_field = false:suggestion
101+
#prefer methods not to be prefaced with this. or Me. in Visual Basic
102+
dotnet_style_qualification_for_method = false:suggestion
103+
#prefer properties not to be prefaced with this. or Me. in Visual Basic
104+
dotnet_style_qualification_for_property = false:suggestion
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: Bug report
3+
about: Report a bug and help us to improve Serilog.Sinks.AzureTableStorage
4+
title: ''
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
The maintainers want you to have a great experience using Serilog.Sinks.AzureTableStorage, and will happily track down and resolve bugs. We all have limited time, though, so please think through all of the factors that might be involved and include as much useful information as possible 😊.
11+
12+
👉 Please ensure that this is the most appropriate repository for your bug report. Only reports for bugs directly caused by code in this specific repository can be accepted.
13+
14+
**Description**
15+
What's going wrong?
16+
17+
**Reproduction**
18+
Please provide code samples showing how you're configuring and calling the sink and Serilog to produce the behavior.
19+
20+
**Expected behavior**
21+
A concise description of what you expected to happen.
22+
23+
**Relevant package, tooling and runtime versions**
24+
What package version are you using, on what platform?
25+
26+
**Additional context**
27+
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
contact_links:
2+
- name: Ask for help
3+
url: https://stackoverflow.com/questions/tagged/serilog
4+
about: Ask the community for help with using Serilog and this sink
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: Feature request
3+
about: Suggest an improvement to Serilog.Sinks.AzureTableStorage
4+
title: ''
5+
labels: enhancement
6+
assignees: ''
7+
8+
---
9+
10+
**Describe your suggestion**
11+
A clear and concise description of what you want to happen. Please include enough information about your reasoning and expected benefits: feature suggestions need to go into _why_ the feature is needed.
12+
13+
**Describe alternatives you've considered**
14+
A clear and concise description of any alternative solutions or features you've considered.
15+
16+
**Additional context**
17+
Add any other context or screenshots about the feature request here.

.github/workflows/build.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Build
2+
3+
env:
4+
BUILD_VERSION: "7.0.${{github.run_number}}${{startsWith(github.ref, 'refs/heads/master') && '' || '-beta'}}"
5+
BUILD_INFORMATION: "7.0.${{github.run_number}}${{startsWith(github.ref, 'refs/heads/master') && '' || '-beta'}}+Branch.${{github.ref_name}}.Sha.${{github.sha}}"
6+
7+
on: [push, pull_request]
8+
9+
jobs:
10+
build:
11+
name: Build
12+
runs-on: ubuntu-latest
13+
14+
services:
15+
azurite:
16+
image: mcr.microsoft.com/azure-storage/azurite
17+
ports:
18+
- 10000:10000
19+
- 10001:10001
20+
- 10002:10002
21+
volumes:
22+
- azurite_data:/data mcr.microsoft.com/azure-storage/azurite
23+
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v3
27+
28+
- name: Setup .NET
29+
uses: actions/setup-dotnet@v3
30+
with:
31+
dotnet-version: |
32+
3.1.x
33+
6.0.x
34+
35+
- name: Restore Dependencies
36+
run: dotnet restore
37+
38+
- name: Build Project
39+
run: 'dotnet build --no-restore --configuration Release -p:Version="${{env.BUILD_VERSION}}" -p:InformationalVersion="${{env.BUILD_INFORMATION}}"'
40+
41+
- name: Test Project
42+
run: 'dotnet test --no-build --no-restore --configuration Release'
43+
44+
- name: Create Packages
45+
if: success() && github.event_name != 'pull_request'
46+
run: 'dotnet pack --configuration Release --include-symbols --include-source --no-build --no-restore --output "${{github.workspace}}/artifacts" -p:PackageVersion="${{env.BUILD_VERSION}}"'
47+
48+
- name: Upload Artifacts
49+
if: success() && github.event_name != 'pull_request'
50+
uses: actions/upload-artifact@v3
51+
with:
52+
name: artifacts
53+
path: '${{github.workspace}}/artifacts'
54+
55+
- name: Publish Build Packages
56+
if: success() && github.event_name != 'pull_request'
57+
run: dotnet nuget push ./artifacts/*.nupkg --source https://nuget.pkg.github.com/serilog-contrib/index.json --api-key ${GITHUB_TOKEN} --skip-duplicate
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
61+
- name: Create Release
62+
if: success() && startsWith(github.ref, 'refs/heads/master')
63+
run: 'gh release create "${{env.BUILD_VERSION}}" ./artifacts/*.nupkg --title "v${{env.BUILD_VERSION}}"'
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
67+
- name: Publish Release Packages
68+
if: success() && startsWith(github.ref, 'refs/heads/master')
69+
run: dotnet nuget push ./artifacts/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${NUGET_API_KEY} --skip-duplicate
70+
env:
71+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
## Ignore Visual Studio temporary files, build results, and
22
## files generated by popular Visual Studio add-ons.
33

4-
.vs/
5-
project.lock.json
6-
74
# User-specific files
85
*.suo
96
*.user
@@ -161,6 +158,7 @@ ClientBin/
161158
*.pfx
162159
*.publishsettings
163160
node_modules/
161+
.vs/
164162

165163
# RIA/Silverlight projects
166164
Generated_Code/
@@ -185,3 +183,5 @@ UpgradeLog*.htm
185183
# Microsoft Fakes
186184
FakesAssemblies/
187185

186+
.vscode/
187+

Build.ps1

Lines changed: 22 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,37 @@ echo "build: Build started"
22

33
Push-Location $PSScriptRoot
44

5-
if(Test-Path .\artifacts) {
6-
echo "build: Cleaning .\artifacts"
7-
Remove-Item .\artifacts -Force -Recurse
5+
if (Test-Path ./artifacts) {
6+
echo "build: Cleaning ./artifacts"
7+
Remove-Item ./artifacts -Force -Recurse
88
}
99

10+
echo "build: Restoring"
1011
& dotnet restore --no-cache
12+
if($LASTEXITCODE -ne 0) { exit 1 }
1113

12-
$branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$env:APPVEYOR_REPO_BRANCH -ne $NULL];
13-
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
14-
$suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "master" -and $revision -ne "local"]
15-
$commitHash = $(git rev-parse --short HEAD)
16-
$buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($commitHash)" }[$suffix -ne ""]
14+
$projectName = "Serilog.Sinks.AzureTableStorage"
15+
$ref = $env:GITHUB_REF ?? ""
16+
$run = $env:GITHUB_RUN_NUMBER ?? "0"
17+
$branch = @{ $true = $ref.Substring($ref.LastIndexOf("/") + 1); $false = $(git symbolic-ref --short -q HEAD) }[$ref -ne ""];
18+
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $run, 10); $false = "local" }[$run -ne "0"];
19+
$suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "main" -and $revision -ne "local"]
1720

18-
echo "build: Package version suffix is $suffix"
19-
echo "build: Build version suffix is $buildSuffix"
21+
echo "build: Version suffix is $suffix"
2022

21-
foreach ($src in ls src/*) {
22-
Push-Location $src
23+
& dotnet test -c Release "./test/$projectName.Tests/$projectName.Tests.csproj"
24+
if ($LASTEXITCODE -ne 0) { throw "dotnet test failed" }
2325

24-
echo "build: Packaging project in $src"
26+
$src = "./src/$projectName"
2527

26-
& dotnet build -c Release --version-suffix=$buildSuffix
27-
if ($suffix) {
28-
& dotnet pack -c Release --include-source -o ..\..\artifacts --version-suffix=$suffix --no-build
29-
} else {
30-
& dotnet pack -c Release --include-source -o ..\..\artifacts --no-build
31-
}
32-
if($LASTEXITCODE -ne 0) { exit 1 }
28+
& dotnet build -c Release --version-suffix=$suffix "$src/$projectName.csproj"
29+
if ($LASTEXITCODE -ne 0) { throw "dotnet build failed" }
3330

34-
Pop-Location
35-
}
36-
37-
foreach ($test in ls test/*.Tests) {
38-
Push-Location $test
39-
40-
echo "build: Testing project in $test"
41-
42-
& dotnet test -c Release
43-
if($LASTEXITCODE -ne 0) { exit 3 }
44-
45-
Pop-Location
31+
if ($suffix) {
32+
& dotnet pack -c Release -o ./artifacts --no-build --version-suffix=$suffix "$src/$projectName.csproj"
33+
} else {
34+
& dotnet pack -c Release -o ./artifacts --no-build "$src/$projectName.csproj"
4635
}
36+
if ($LASTEXITCODE -ne 0) { throw "dotnet pack failed" }
4737

4838
Pop-Location

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
6.0.0
2+
* Updated dependencies: replace deprecated package WindowsAzure.Storage with Microsoft.Azure.Cosmos.Table 1.0.8
3+
* Updated dependencies: Serilog 2.10.0
4+
15
5.0.0
26
* Migrated to new CSPROJ project system
37
* Updated dependencies: WindowsAzure.Storage 8.6.0, Serilog 2.6.0, Serilog.Sinks.PeriodicBatching 2.1.1

README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
# Serilog.Sinks.AzureTableStorage [![Build status](https://ci.appveyor.com/api/projects/status/bb9v4y9dguyn7w9a/branch/master?svg=true)](https://ci.appveyor.com/project/serilog/serilog-sinks-azuretablestorage/branch/master)
1+
# Serilog.Sinks.AzureTableStorage [![Nuget](https://img.shields.io/nuget/v/serilog.sinks.azuretablestorage)](http://nuget.org/packages/serilog.sinks.azuretablestorage)
2+
Writes to a table in [Azure Table Storage](https://azure.microsoft.com/en-us/services/storage/tables/).
23

3-
Writes to a table in [Windows Azure Table Storage](https://azure.microsoft.com/en-us/documentation/articles/storage-dotnet-how-to-use-tables/).
4-
5-
**Package** - [Serilog.Sinks.AzureTableStorage](http://nuget.org/packages/serilog.sinks.azuretablestorage) | **Platforms** - .NET 4.5
4+
**Package** - [Serilog.Sinks.AzureTableStorage](http://nuget.org/packages/serilog.sinks.azuretablestorage) | **Platforms** - .NET Standard 2.0
65

76
```csharp
8-
var storage = CloudStorageAccount.FromConfigurationSetting("MyStorage");
9-
107
var log = new LoggerConfiguration()
11-
.WriteTo.AzureTableStorage(storage)
8+
.WriteTo.AzureTableStorage("<connectionString>")
129
.CreateLogger();
1310
```
1411

@@ -50,4 +47,10 @@ In your application's `App.config` or `Web.config` file, specify the file sink a
5047
<add key="serilog:using:AzureTableStorage" value="Serilog.Sinks.AzureTableStorage" />
5148
<add key="serilog:write-to:AzureTableStorage.connectionString" value="DefaultEndpointsProtocol=https;AccountName=ACCOUNT_NAME;AccountKey=KEY;EndpointSuffix=core.windows.net" />
5249
<add key="serilog:write-to:AzureTableStorage.formatter" value="Serilog.Formatting.Compact.CompactJsonFormatter, Serilog.Formatting.Compact" />
50+
</appSettings>
51+
</configuration>
5352
```
53+
54+
### Async approach
55+
It is possible to configure the collector using [Serilog.Sinks.Async](https://github.com/serilog/serilog-sinks-async) to have an async approach.
56+

appveyor.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)