Skip to content

Commit c7b9bc3

Browse files
authored
Merge pull request #312 from serilog/dev
6.0.0 Release
2 parents 7eb21bd + 2d9fd8f commit c7b9bc3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+2615
-3173
lines changed

.editorconfig

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ trim_trailing_whitespace = true
55
insert_final_newline = true
66
indent_style = space
77
indent_size = 4
8+
charset = utf-8
89

910
[*.{csproj,json,config,yml,props}]
1011
indent_size = 2
@@ -14,3 +15,8 @@ end_of_line = lf
1415

1516
[*.{cmd, bat}]
1617
end_of_line = crlf
18+
19+
# C# formatting settings - Namespace options
20+
csharp_style_namespace_declarations = file_scoped:suggestion
21+
22+
csharp_style_prefer_switch_expression = true:suggestion

.github/ISSUE_TEMPLATE/bug_report.md

+27
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.File
4+
title: ''
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
The Serilog maintainers want you to have a great experience using Serilog.Sinks.File, 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+
ℹ If the problem is caused by a sink or other extension package, please track down the correct repository for that package and create the report there: this tracker is for the **Serilog.Sinks.File** package only.
13+
14+
**Description**
15+
What's going wrong?
16+
17+
**Reproduction**
18+
Please provide code samples showing how you're configuring and calling Serilog.Sinks.File 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 Serilog.Sinks.File 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

+4
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/tags/serilog
4+
about: Ask for help on how to use Serilog.Sinks.File
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an improvement to Serilog.Sinks.File
4+
title: ''
5+
labels: enhancement
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. For example, "I'd like to do _x_ but currently I can't because _y_ [...]".
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any workarounds or alternative solutions you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

Build.ps1

+14-18
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,42 @@
1-
echo "build: Build started"
1+
Write-Output "build: Build started"
22

33
Push-Location $PSScriptRoot
44

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

1010
& dotnet restore --no-cache
1111

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];
12+
$branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$NULL -ne $env:APPVEYOR_REPO_BRANCH];
13+
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$NULL -ne $env:APPVEYOR_BUILD_NUMBER];
1414
$suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "main" -and $revision -ne "local"]
15-
$commitHash = $(git rev-parse --short HEAD)
16-
$buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($commitHash)" }[$suffix -ne ""]
1715

18-
echo "build: Package version suffix is $suffix"
19-
echo "build: Build version suffix is $buildSuffix"
16+
Write-Output "build: Package version suffix is $suffix"
2017

21-
foreach ($src in ls src/*) {
18+
foreach ($src in Get-ChildItem src/*) {
2219
Push-Location $src
2320

24-
echo "build: Packaging project in $src"
21+
Write-Output "build: Packaging project in $src"
2522

26-
& dotnet build -c Release --version-suffix=$buildSuffix -p:EnableSourceLink=true
2723
if ($suffix) {
28-
& dotnet pack -c Release -o ..\..\artifacts --version-suffix=$suffix --no-build
24+
& dotnet pack -c Release --include-source -o ../../artifacts --version-suffix=$suffix
2925
} else {
30-
& dotnet pack -c Release -o ..\..\artifacts --no-build
26+
& dotnet pack -c Release --include-source -o ../../artifacts
3127
}
32-
if($LASTEXITCODE -ne 0) { exit 1 }
28+
if($LASTEXITCODE -ne 0) { throw "Packaging failed" }
3329

3430
Pop-Location
3531
}
3632

37-
foreach ($test in ls test/*.Tests) {
33+
foreach ($test in Get-ChildItem test/*.Tests) {
3834
Push-Location $test
3935

40-
echo "build: Testing project in $test"
36+
Write-Output "build: Testing project in $test"
4137

4238
& dotnet test -c Release
43-
if($LASTEXITCODE -ne 0) { exit 3 }
39+
if($LASTEXITCODE -ne 0) { throw "Testing failed" }
4440

4541
Pop-Location
4642
}

Directory.Build.props

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Project>
2+
<PropertyGroup>
3+
<LangVersion>latest</LangVersion>
4+
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
5+
<SignAssembly>true</SignAssembly>
6+
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
7+
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)assets/Serilog.snk</AssemblyOriginatorKeyFile>
8+
<Nullable>enable</Nullable>
9+
<ImplicitUsings>enable</ImplicitUsings>
10+
<LangVersion>latest</LangVersion>
11+
</PropertyGroup>
12+
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
13+
<Reference Include="System" />
14+
<Reference Include="System.Core" />
15+
<Reference Include="Microsoft.CSharp" />
16+
</ItemGroup>
17+
</Project>

Directory.Build.targets

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<Project>
2+
3+
<ItemGroup>
4+
<Using Remove="System.Net.Http" />
5+
</ItemGroup>
6+
7+
</Project>

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Serilog.Sinks.File [![Build status](https://ci.appveyor.com/api/projects/status/hh9gymy0n6tne46j?svg=true)](https://ci.appveyor.com/project/serilog/serilog-sinks-file) [![NuGet Version](http://img.shields.io/nuget/v/Serilog.Sinks.File.svg?style=flat)](https://www.nuget.org/packages/Serilog.Sinks.File/) [![Documentation](https://img.shields.io/badge/docs-wiki-yellow.svg)](https://github.com/serilog/serilog/wiki) [![Join the chat at https://gitter.im/serilog/serilog](https://img.shields.io/gitter/room/serilog/serilog.svg)](https://gitter.im/serilog/serilog)
1+
# Serilog.Sinks.File [![Build status](https://ci.appveyor.com/api/projects/status/hh9gymy0n6tne46j/branch/dev?svg=true)](https://ci.appveyor.com/project/serilog/serilog-sinks-file/branch/dev) [![NuGet Version](http://img.shields.io/nuget/v/Serilog.Sinks.File.svg?style=flat)](https://www.nuget.org/packages/Serilog.Sinks.File/) [![Documentation](https://img.shields.io/badge/docs-wiki-yellow.svg)](https://github.com/serilog/serilog/wiki)
22

33
Writes [Serilog](https://serilog.net) events to one or more text files.
44

@@ -7,7 +7,7 @@ Writes [Serilog](https://serilog.net) events to one or more text files.
77
Install the [Serilog.Sinks.File](https://www.nuget.org/packages/Serilog.Sinks.File/) package from NuGet:
88

99
```powershell
10-
Install-Package Serilog.Sinks.File
10+
dotnet add package Serilog.Sinks.File
1111
```
1212

1313
To configure the sink in C# code, call `WriteTo.File()` during logger configuration:
@@ -36,7 +36,7 @@ The limit can be changed or removed using the `fileSizeLimitBytes` parameter.
3636

3737
```csharp
3838
.WriteTo.File("log.txt", fileSizeLimitBytes: null)
39-
```
39+
```
4040

4141
For the same reason, only **the most recent 31 files** are retained by default (i.e. one long month). To change or remove this limit, pass the `retainedFileCountLimit` parameter.
4242

appveyor.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
version: '{build}'
22
skip_tags: true
33
image:
4-
- Visual Studio 2019
5-
- Ubuntu
4+
- Visual Studio 2022
5+
- Ubuntu2204
66
build_script:
7-
- ps: ./Build.ps1
7+
- pwsh: ./Build.ps1
88
for:
99
-
1010
matrix:
@@ -15,17 +15,17 @@ for:
1515
test: off
1616
artifacts:
1717
- path: artifacts/Serilog.*.nupkg
18+
- path: artifacts/Serilog.*.snupkg
1819
deploy:
1920
- provider: NuGet
2021
api_key:
21-
secure: rbdBqxBpLt4MkB+mrDOYNDOd8aVZ1zMkysaVNAXNKnC41FYifzX3l9LM8DCrUWU5
22-
skip_symbols: true
22+
secure: sDnchSg4TZIOK7oIUI6BJwFPNENTOZrGNsroGO1hehLJSvlHpFmpTwiX8+bgPD+Q
2323
on:
2424
branch: /^(main|dev)$/
2525
- provider: GitHub
2626
auth_token:
2727
secure: p4LpVhBKxGS5WqucHxFQ5c7C8cP74kbNB0Z8k9Oxx/PMaDQ1+ibmoexNqVU5ZlmX
28-
artifact: /Serilog.*\.nupkg/
28+
artifact: /Serilog.*(\.|\.s)nupkg/
2929
tag: v$(appveyor_build_version)
3030
on:
3131
branch: main

build.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#!/bin/bash
1+
#!/bin/bash
22

3-
set -e
3+
set -e
44
dotnet --info
55
dotnet --list-sdks
66
dotnet restore

example/Sample/Program.cs

+16-27
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,27 @@
1-
using System;
2-
using System.IO;
31
using Serilog;
42
using Serilog.Debugging;
53

6-
namespace Sample
7-
{
8-
public class Program
9-
{
10-
public static void Main(string[] args)
11-
{
12-
SelfLog.Enable(Console.Out);
4+
SelfLog.Enable(Console.Out);
135

14-
var sw = System.Diagnostics.Stopwatch.StartNew();
6+
var sw = System.Diagnostics.Stopwatch.StartNew();
157

16-
Log.Logger = new LoggerConfiguration()
17-
.WriteTo.File("log.txt")
18-
.CreateLogger();
8+
Log.Logger = new LoggerConfiguration()
9+
.WriteTo.File("log.txt")
10+
.CreateLogger();
1911

20-
for (var i = 0; i < 1000000; ++i)
21-
{
22-
Log.Information("Hello, file logger!");
23-
}
12+
for (var i = 0; i < 1000000; ++i)
13+
{
14+
Log.Information("Hello, file logger!");
15+
}
2416

25-
Log.CloseAndFlush();
17+
Log.CloseAndFlush();
2618

27-
sw.Stop();
19+
sw.Stop();
2820

29-
Console.WriteLine($"Elapsed: {sw.ElapsedMilliseconds} ms");
30-
Console.WriteLine($"Size: {new FileInfo("log.txt").Length}");
21+
Console.WriteLine($"Elapsed: {sw.ElapsedMilliseconds} ms");
22+
Console.WriteLine($"Size: {new FileInfo("log.txt").Length}");
3123

32-
Console.WriteLine("Press any key to delete the temporary log file...");
33-
Console.ReadKey(true);
24+
Console.WriteLine("Press any key to delete the temporary log file...");
25+
Console.ReadKey(true);
3426

35-
File.Delete("log.txt");
36-
}
37-
}
38-
}
27+
File.Delete("log.txt");

example/Sample/Sample.csproj

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net48;net5.0</TargetFrameworks>
5-
<LangVersion>8.0</LangVersion>
6-
<Nullable>enable</Nullable>
7-
<AssemblyName>Sample</AssemblyName>
4+
<TargetFrameworks>net48;net8.0</TargetFrameworks>
85
<OutputType>Exe</OutputType>
9-
<PackageId>Sample</PackageId>
106
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
117
</PropertyGroup>
128

serilog-sinks-file.sln

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 15
4-
VisualStudioVersion = 15.0.26730.15
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.5.33424.131
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{037440DE-440B-4129-9F7A-09B42D00397E}"
77
EndProject
@@ -11,6 +11,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "assets", "assets", "{E9D1B5
1111
appveyor.yml = appveyor.yml
1212
Build.ps1 = Build.ps1
1313
build.sh = build.sh
14+
Directory.Build.props = Directory.Build.props
15+
Directory.Build.targets = Directory.Build.targets
1416
README.md = README.md
1517
assets\Serilog.snk = assets\Serilog.snk
1618
EndProjectSection

0 commit comments

Comments
 (0)