Skip to content

6.0.0 Release #312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 34 commits into from
Jun 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
764bb4a
Dev version bump [skip ci]
nblumhardt Jun 25, 2021
5d31694
Update Serilog.Sinks.File.csproj
Sjoerdsjoerd Sep 20, 2021
d2117ab
Merge pull request #241 from Sjoerdsjoerd/patch-1
nblumhardt Sep 20, 2021
60dafd2
Update issue templates
nblumhardt May 20, 2022
276d6c5
build against vs 2022
SimonCropp Feb 3, 2023
45aa062
Merge pull request #274 from SimonCropp/dev
SimonCropp Feb 3, 2023
8bd0d9d
update nuget token
SimonCropp Feb 3, 2023
3fac905
Revert "update nuget token"
SimonCropp Feb 3, 2023
3d0f351
use same nuget key as main serilog repo
SimonCropp Mar 11, 2023
2d2e00b
Merge pull request #279 from serilog/use-same-nuget-key-as-main-seril…
SimonCropp Mar 11, 2023
ef5b156
Code cleanup
sungam3r Mar 13, 2023
250f526
fix
sungam3r Mar 13, 2023
b758e6d
use not-eol target frameworks
zachrybaker Sep 6, 2023
a3d9c9c
maintain 5.0 interop
zachrybaker Sep 6, 2023
1cc5eff
Update src/Serilog.Sinks.File/Serilog.Sinks.File.csproj
zachrybaker Sep 7, 2023
23707da
Use dev branch build status in README [skip ci]
nblumhardt Sep 28, 2023
9e610e0
Update publishing key
nblumhardt Sep 28, 2023
4956a67
Merge pull request #254 from nblumhardt/new-issue-templates
nblumhardt Sep 28, 2023
6c3cb34
Merge pull request #295 from zachrybaker/update-tf
nblumhardt Sep 28, 2023
e17aed9
Remove obsolete Gitter link [skip ci]
nblumhardt Sep 28, 2023
306e6cb
Generate symbols
MonticolaExplorator Dec 2, 2023
3f2fad2
Test publication
MonticolaExplorator Dec 2, 2023
73ef3d3
Revert "Test publication"
MonticolaExplorator Dec 2, 2023
9cb12d3
Merge pull request #1 from MonticolaExplorator/okappveyor
MonticolaExplorator Dec 2, 2023
2a61b4b
Merge pull request #303 from MonticolaExplorator/dev
nblumhardt Dec 26, 2023
1ea2c9f
Merge branch 'dev' into style
sungam3r Jan 14, 2024
2aece6d
TFMs
sungam3r Jan 14, 2024
f709698
revert TFMs
sungam3r Jan 14, 2024
08e9025
Merge pull request #280 from sungam3r/style
nblumhardt Jun 17, 2024
4688ab3
Dependency updates, langversion, embed README
nblumhardt Jun 19, 2024
3aaa8fc
Use MaxBy() where available; other language feature usage updates
nblumhardt Jun 19, 2024
992ca76
Update build script
nblumhardt Jun 19, 2024
58939c6
Use new Ubuntu build worker
nblumhardt Jun 19, 2024
2d9fd8f
Merge pull request #311 from nblumhardt/serilog-4
nblumhardt Jun 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 4
charset = utf-8

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

[*.{cmd, bat}]
end_of_line = crlf

# C# formatting settings - Namespace options
csharp_style_namespace_declarations = file_scoped:suggestion

csharp_style_prefer_switch_expression = true:suggestion
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Bug report
about: Report a bug and help us to improve Serilog.Sinks.File
title: ''
labels: bug
assignees: ''

---

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 😊.

ℹ 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.

**Description**
What's going wrong?

**Reproduction**
Please provide code samples showing how you're configuring and calling Serilog.Sinks.File to produce the behavior.

**Expected behavior**
A concise description of what you expected to happen.

**Relevant package, tooling and runtime versions**
What Serilog.Sinks.File version are you using, on what platform?

**Additional context**
Add any other context about the problem here.
4 changes: 4 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
contact_links:
- name: Ask for help
url: https://stackoverflow.com/tags/serilog
about: Ask for help on how to use Serilog.Sinks.File
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an improvement to Serilog.Sinks.File
title: ''
labels: enhancement
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
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_ [...]".

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any workarounds or alternative solutions you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
32 changes: 14 additions & 18 deletions Build.ps1
Original file line number Diff line number Diff line change
@@ -1,46 +1,42 @@
echo "build: Build started"
Write-Output "build: Build started"

Push-Location $PSScriptRoot

if(Test-Path .\artifacts) {
echo "build: Cleaning .\artifacts"
Remove-Item .\artifacts -Force -Recurse
Write-Output "build: Cleaning ./artifacts"
Remove-Item ./artifacts -Force -Recurse
}

& dotnet restore --no-cache

$branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$env:APPVEYOR_REPO_BRANCH -ne $NULL];
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
$branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$NULL -ne $env:APPVEYOR_REPO_BRANCH];
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$NULL -ne $env:APPVEYOR_BUILD_NUMBER];
$suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "main" -and $revision -ne "local"]
$commitHash = $(git rev-parse --short HEAD)
$buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($commitHash)" }[$suffix -ne ""]

echo "build: Package version suffix is $suffix"
echo "build: Build version suffix is $buildSuffix"
Write-Output "build: Package version suffix is $suffix"

foreach ($src in ls src/*) {
foreach ($src in Get-ChildItem src/*) {
Push-Location $src

echo "build: Packaging project in $src"
Write-Output "build: Packaging project in $src"

& dotnet build -c Release --version-suffix=$buildSuffix -p:EnableSourceLink=true
if ($suffix) {
& dotnet pack -c Release -o ..\..\artifacts --version-suffix=$suffix --no-build
& dotnet pack -c Release --include-source -o ../../artifacts --version-suffix=$suffix
} else {
& dotnet pack -c Release -o ..\..\artifacts --no-build
& dotnet pack -c Release --include-source -o ../../artifacts
}
if($LASTEXITCODE -ne 0) { exit 1 }
if($LASTEXITCODE -ne 0) { throw "Packaging failed" }

Pop-Location
}

foreach ($test in ls test/*.Tests) {
foreach ($test in Get-ChildItem test/*.Tests) {
Push-Location $test

echo "build: Testing project in $test"
Write-Output "build: Testing project in $test"

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

Pop-Location
}
Expand Down
17 changes: 17 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)assets/Serilog.snk</AssemblyOriginatorKeyFile>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
</Project>
7 changes: 7 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project>

<ItemGroup>
<Using Remove="System.Net.Http" />
</ItemGroup>

</Project>
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 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)
# 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)

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

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

```powershell
Install-Package Serilog.Sinks.File
dotnet add package Serilog.Sinks.File
```

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

```csharp
.WriteTo.File("log.txt", fileSizeLimitBytes: null)
```
```

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.

Expand Down
12 changes: 6 additions & 6 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
version: '{build}'
skip_tags: true
image:
- Visual Studio 2019
- Ubuntu
- Visual Studio 2022
- Ubuntu2204
build_script:
- ps: ./Build.ps1
- pwsh: ./Build.ps1
for:
-
matrix:
Expand All @@ -15,17 +15,17 @@ for:
test: off
artifacts:
- path: artifacts/Serilog.*.nupkg
- path: artifacts/Serilog.*.snupkg
deploy:
- provider: NuGet
api_key:
secure: rbdBqxBpLt4MkB+mrDOYNDOd8aVZ1zMkysaVNAXNKnC41FYifzX3l9LM8DCrUWU5
skip_symbols: true
secure: sDnchSg4TZIOK7oIUI6BJwFPNENTOZrGNsroGO1hehLJSvlHpFmpTwiX8+bgPD+Q
on:
branch: /^(main|dev)$/
- provider: GitHub
auth_token:
secure: p4LpVhBKxGS5WqucHxFQ5c7C8cP74kbNB0Z8k9Oxx/PMaDQ1+ibmoexNqVU5ZlmX
artifact: /Serilog.*\.nupkg/
artifact: /Serilog.*(\.|\.s)nupkg/
tag: v$(appveyor_build_version)
on:
branch: main
4 changes: 2 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#!/bin/bash

set -e
set -e
dotnet --info
dotnet --list-sdks
dotnet restore
Expand Down
43 changes: 16 additions & 27 deletions example/Sample/Program.cs
Original file line number Diff line number Diff line change
@@ -1,38 +1,27 @@
using System;
using System.IO;
using Serilog;
using Serilog.Debugging;

namespace Sample
{
public class Program
{
public static void Main(string[] args)
{
SelfLog.Enable(Console.Out);
SelfLog.Enable(Console.Out);

var sw = System.Diagnostics.Stopwatch.StartNew();
var sw = System.Diagnostics.Stopwatch.StartNew();

Log.Logger = new LoggerConfiguration()
.WriteTo.File("log.txt")
.CreateLogger();
Log.Logger = new LoggerConfiguration()
.WriteTo.File("log.txt")
.CreateLogger();

for (var i = 0; i < 1000000; ++i)
{
Log.Information("Hello, file logger!");
}
for (var i = 0; i < 1000000; ++i)
{
Log.Information("Hello, file logger!");
}

Log.CloseAndFlush();
Log.CloseAndFlush();

sw.Stop();
sw.Stop();

Console.WriteLine($"Elapsed: {sw.ElapsedMilliseconds} ms");
Console.WriteLine($"Size: {new FileInfo("log.txt").Length}");
Console.WriteLine($"Elapsed: {sw.ElapsedMilliseconds} ms");
Console.WriteLine($"Size: {new FileInfo("log.txt").Length}");

Console.WriteLine("Press any key to delete the temporary log file...");
Console.ReadKey(true);
Console.WriteLine("Press any key to delete the temporary log file...");
Console.ReadKey(true);

File.Delete("log.txt");
}
}
}
File.Delete("log.txt");
8 changes: 2 additions & 6 deletions example/Sample/Sample.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net48;net5.0</TargetFrameworks>
<LangVersion>8.0</LangVersion>
<Nullable>enable</Nullable>
<AssemblyName>Sample</AssemblyName>
<TargetFrameworks>net48;net8.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<PackageId>Sample</PackageId>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>

Expand Down
6 changes: 4 additions & 2 deletions serilog-sinks-file.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26730.15
# Visual Studio Version 17
VisualStudioVersion = 17.5.33424.131
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{037440DE-440B-4129-9F7A-09B42D00397E}"
EndProject
Expand All @@ -11,6 +11,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "assets", "assets", "{E9D1B5
appveyor.yml = appveyor.yml
Build.ps1 = Build.ps1
build.sh = build.sh
Directory.Build.props = Directory.Build.props
Directory.Build.targets = Directory.Build.targets
README.md = README.md
assets\Serilog.snk = assets\Serilog.snk
EndProjectSection
Expand Down
Loading