Skip to content

Commit 0a7ff3d

Browse files
authored
Merge pull request #53 from serilog/dev
3.0.0 Release
2 parents dd71bd6 + 5b918a8 commit 0a7ff3d

File tree

9 files changed

+86
-56
lines changed

9 files changed

+86
-56
lines changed

Build.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ if(Test-Path .\artifacts) {
1111

1212
$branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$env:APPVEYOR_REPO_BRANCH -ne $NULL];
1313
$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"]
14+
$suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "main" -and $revision -ne "local"]
1515
$commitHash = $(git rev-parse --short HEAD)
1616
$buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($commitHash)" }[$suffix -ne ""]
1717

@@ -23,7 +23,7 @@ foreach ($src in ls src/*) {
2323

2424
echo "build: Packaging project in $src"
2525

26-
& dotnet build -c Release --version-suffix=$buildSuffix
26+
& dotnet build -c Release --version-suffix=$buildSuffix /p:ContinuousIntegrationBuild=true
2727

2828
if($suffix) {
2929
& dotnet pack -c Release --include-source --no-build -o ..\..\artifacts --version-suffix=$suffix

README.md

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,14 @@ Sink assemblies must be specified using the `serilog:using` syntax. For example,
7171
If the sink accepts parameters, these are specified by appending the parameter name to the setting.
7272

7373
```csharp
74-
.WriteTo.RollingFile(@"C:\Logs\myapp-{Date}.txt", retainedFileCountLimit: 10)
74+
.WriteTo.File(@"C:\Logs\myapp-{Date}.txt", retainedFileCountLimit: 10)
7575
```
7676

7777
In XML:
7878

7979
```xml
80-
<add key="serilog:write-to:RollingFile.pathFormat" value="C:\Logs\myapp-{Date}.txt" />
81-
<add key="serilog:write-to:RollingFile.retainedFileCountLimit" value="10" />
80+
<add key="serilog:write-to:File.path" value="C:\Logs\myapp-{Date}.txt" />
81+
<add key="serilog:write-to:File.retainedFileCountLimit" value="10" />
8282
```
8383

8484
Any environment variables specified in a setting value (e.g. `%TEMP%`) will be expanded appropriately when read.
@@ -140,3 +140,25 @@ For example, to configure the `RollingInterval` of the [File Sink](https://githu
140140
```
141141

142142
If you specify the the name of the enumeration, you'll receive an error similar to `System.ArgumentException: Requested value 'RollingInterval.Day' was not found`
143+
144+
### Destructuring
145+
146+
```csharp
147+
148+
LoggerConfiguration
149+
.Destructure.ToMaximumDepth(maximumDestructuringDepth: 3)
150+
.Destructure.ToMaximumStringLength(maximumStringLength: 3)
151+
.Destructure.ToMaximumCollectionCount(maximumCollectionCount: 3)
152+
.Destructure.AsScalar(typeof(System.Version))
153+
.Destructure.With(new CustomPolicy());
154+
```
155+
156+
and in XML
157+
158+
```xml
159+
<add key="serilog:destructure:ToMaximumDepth.maximumDestructuringDepth" value="3" />
160+
<add key="serilog:destructure:ToMaximumStringLength.maximumStringLength" value="3" />
161+
<add key="serilog:destructure:ToMaximumCollectionCount.maximumCollectionCount" value="3" />
162+
<add key="serilog:destructure:AsScalar.scalarType" value="System.Version" />
163+
<add key="serilog:destructure:With.policy" value="My.CustomPolicy, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
164+
```

appveyor.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
version: '{build}'
22
skip_tags: true
3-
image: Visual Studio 2017
3+
image: Visual Studio 2022
44
configuration: Release
55
build_script:
66
- ps: ./Build.ps1
77
test: off
88
artifacts:
99
- path: artifacts/Serilog.*.nupkg
10+
- path: artifacts/Serilog.*.snupkg
1011
deploy:
1112
- provider: NuGet
1213
api_key:
13-
secure: bd9z4P73oltOXudAjPehwp9iDKsPtC+HbgshOrSgoyQKr5xVK+bxJQngrDJkHdY8
14+
secure: 0blv8+bRwb/S3wEXjl7xdUjJaf/2sONe4TXeGuN/AywGXCMjUL/qBuMo/jHy+bMU
1415
skip_symbols: true
1516
on:
16-
branch: /^(master|dev)$/
17+
branch: /^(main|dev)$/
1718
- provider: GitHub
1819
auth_token:
1920
secure: p4LpVhBKxGS5WqucHxFQ5c7C8cP74kbNB0Z8k9Oxx/PMaDQ1+ibmoexNqVU5ZlmX
20-
artifact: /Serilog.*\.nupkg/
21+
artifacts:
22+
/Serilog.*\.nupkg/
23+
/Serilog.*\.snupkg/
2124
tag: v$(appveyor_build_version)
2225
on:
23-
branch: master
26+
branch: main
2427

assets/icon.png

22.5 KB
Loading

src/Serilog.Settings.AppSettings/AppSettingsLoggerConfigurationExtensions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public static class AppSettingsLoggerConfigurationExtensions
3939
/// <returns>An object allowing configuration to continue.</returns>
4040
[EditorBrowsable(EditorBrowsableState.Never)]
4141
public static LoggerConfiguration AppSettings(
42-
this LoggerSettingsConfiguration settingConfiguration, string settingPrefix)
42+
this LoggerSettingsConfiguration settingConfiguration, string? settingPrefix)
4343
{
4444
return AppSettings(settingConfiguration, settingPrefix, filePath: null);
4545
}
@@ -60,10 +60,10 @@ public static LoggerConfiguration AppSettings(
6060
/// By default, the current application's configuration file will be used.</param>
6161
/// <returns>An object allowing configuration to continue.</returns>
6262
public static LoggerConfiguration AppSettings(
63-
this LoggerSettingsConfiguration settingConfiguration, string settingPrefix = null, string filePath = null)
63+
this LoggerSettingsConfiguration settingConfiguration, string? settingPrefix = null, string? filePath = null)
6464
{
65-
if (settingConfiguration == null) throw new ArgumentNullException(nameof(settingConfiguration));
66-
if (settingPrefix != null)
65+
if (settingConfiguration is null) throw new ArgumentNullException(nameof(settingConfiguration));
66+
if (settingPrefix is not null)
6767
{
6868
if (settingPrefix.Contains(":")) throw new ArgumentException("Custom setting prefixes cannot contain the colon (:) character.");
6969
if (settingPrefix == "serilog") throw new ArgumentException("The value \"serilog\" is not a permitted setting prefix. To use the default, do not specify a custom prefix at all.");

src/Serilog.Settings.AppSettings/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
using System.Reflection;
33
using System.Runtime.CompilerServices;
44

5-
[assembly: AssemblyVersion("2.0.0.0")]
6-
75
[assembly: CLSCompliant(true)]
86

97
[assembly: InternalsVisibleTo("Serilog.Tests, PublicKey=" +
Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,54 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<Description>XML configuration (System.Configuration &lt;appSettings&gt;) support for Serilog.</Description>
5-
<VersionPrefix>2.2.2</VersionPrefix>
5+
<VersionPrefix>3.0.0</VersionPrefix>
66
<Authors>Serilog Contributors</Authors>
7-
<TargetFrameworks>net45;netstandard2.0</TargetFrameworks>
7+
<!-- .NET Framework version targeting is frozen at these two TFMs. -->
8+
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT'">net471;net462</TargetFrameworks>
9+
<!-- Policy is to trim TFM-specific builds to `netstandard2.0`, `net6.0`,
10+
all active LTS versions, and optionally the latest RTM version, when releasing new
11+
major Serilog versions. -->
12+
<TargetFrameworks>$(TargetFrameworks);net8.0;net6.0;netstandard2.0</TargetFrameworks>
813
<AssemblyName>Serilog.Settings.AppSettings</AssemblyName>
914
<AssemblyOriginatorKeyFile>../../assets/Serilog.snk</AssemblyOriginatorKeyFile>
1015
<SignAssembly>true</SignAssembly>
1116
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
1217
<PackageId>Serilog.Settings.AppSettings</PackageId>
1318
<PackageTags>serilog;xml</PackageTags>
14-
<PackageIconUrl>https://serilog.net/images/serilog-configuration-nuget.png</PackageIconUrl>
19+
<PackageIcon>icon.png</PackageIcon>
20+
<PackageReadmeFile>README.md</PackageReadmeFile>
1521
<PackageProjectUrl>https://github.com/serilog/serilog-settings-appsettings</PackageProjectUrl>
16-
<PackageLicenseUrl>https://www.apache.org/licenses/LICENSE-2.0</PackageLicenseUrl>
17-
<RepositoryUrl>https://github.com/serilog/serilog-settings-appsettings</RepositoryUrl>
22+
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
1823
<RepositoryType>git</RepositoryType>
19-
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
20-
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
24+
<PublishRepositoryUrl>true</PublishRepositoryUrl>
25+
<EmbedUntrackedSources>true</EmbedUntrackedSources>
26+
<IncludeSymbols>true</IncludeSymbols>
27+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
2128
<DelaySign>false</DelaySign>
29+
<LangVersion>latest</LangVersion>
30+
<Nullable>enable</Nullable>
2231
</PropertyGroup>
2332

2433
<ItemGroup>
25-
<PackageReference Include="Serilog" Version="2.6.0" />
34+
<PackageReference Include="Serilog" Version="4.0.0" />
2635
</ItemGroup>
2736

28-
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
29-
<Reference Include="System.Configuration" />
30-
<Reference Include="System" />
31-
<Reference Include="Microsoft.CSharp" />
37+
<ItemGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net462'))">
3238
<Reference Include="System.Configuration" />
3339
</ItemGroup>
3440

41+
<ItemGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))">
42+
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.4.1" />
43+
</ItemGroup>
44+
3545
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
36-
<PackageReference Include="System.Configuration.ConfigurationManager">
37-
<Version>4.4.1</Version>
38-
</PackageReference>
46+
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.4.1" />
3947
</ItemGroup>
4048

49+
<ItemGroup>
50+
<None Include="..\..\assets\icon.png" Pack="true" PackagePath="" Visible="false" />
51+
<None Include="..\..\README.md" Pack="true" PackagePath="" />
52+
</ItemGroup>
4153

4254
</Project>

src/Serilog.Settings.AppSettings/Settings/AppSettings/AppSettingsSettings.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,18 @@ namespace Serilog.Settings.AppSettings
2424
{
2525
class AppSettingsSettings : ILoggerSettings
2626
{
27-
readonly string _filePath;
27+
readonly string? _filePath;
2828
readonly string _settingPrefix;
2929

30-
public AppSettingsSettings(string settingPrefix = null, string filePath = null)
30+
public AppSettingsSettings(string? settingPrefix = null, string? filePath = null)
3131
{
3232
_filePath = filePath;
33-
_settingPrefix = settingPrefix == null ? "serilog:" : $"{settingPrefix}:serilog:";
33+
_settingPrefix = settingPrefix is null ? "serilog:" : $"{settingPrefix}:serilog:";
3434
}
3535

3636
public void Configure(LoggerConfiguration loggerConfiguration)
3737
{
38-
if (loggerConfiguration == null) throw new ArgumentNullException(nameof(loggerConfiguration));
38+
if (loggerConfiguration is null) throw new ArgumentNullException(nameof(loggerConfiguration));
3939

4040
IEnumerable<KeyValuePair<string, string>> settings;
4141

@@ -56,7 +56,7 @@ public void Configure(LoggerConfiguration loggerConfiguration)
5656
else
5757
{
5858
settings = ConfigurationManager.AppSettings.AllKeys
59-
.Select(k => new KeyValuePair<string, string>(k, ConfigurationManager.AppSettings[k]));
59+
.Select(k => new KeyValuePair<string, string>(k, ConfigurationManager.AppSettings[k]!));
6060
}
6161

6262
var pairs = settings

test/Serilog.Settings.AppSettings.Tests/Serilog.Settings.AppSettings.Tests.csproj

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net45;netcoreapp2.0</TargetFrameworks>
4+
<TargetFrameworks>net8.0;net48</TargetFrameworks>
55
<IsPackable>false</IsPackable>
66
</PropertyGroup>
77

@@ -10,24 +10,19 @@
1010
</ItemGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
14-
<PackageReference Include="xunit" Version="2.3.1" />
15-
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
16-
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
17-
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
18-
<PackageReference Include="Serilog.Sinks.TextWriter" Version="2.0.0" />
19-
<PackageReference Include="Serilog.Sinks.RollingFile" Version="3.1.0" />
20-
<PackageReference Include="Serilog.Sinks.PeriodicBatching" Version="2.0.0" />
21-
<PackageReference Include="Serilog.Sinks.Observable" Version="2.0.0-*" />
22-
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.0.0-*" />
23-
<PackageReference Include="Serilog.Enrichers.Process" Version="2.0.0-*" />
24-
<PackageReference Include="Serilog.Enrichers.Thread" Version="2.0.0" />
25-
</ItemGroup>
26-
27-
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
28-
<Reference Include="System.Configuration" />
29-
<Reference Include="System" />
30-
<Reference Include="Microsoft.CSharp" />
13+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
14+
<PackageReference Include="xunit" Version="2.8.1" />
15+
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1">
16+
<PrivateAssets>all</PrivateAssets>
17+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
18+
</PackageReference>
19+
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
20+
<PackageReference Include="Serilog.Sinks.TextWriter" Version="3.0.0" />
21+
<PackageReference Include="Serilog.Sinks.PeriodicBatching" Version="5.0.0" />
22+
<PackageReference Include="Serilog.Sinks.Observable" Version="3.0.0" />
23+
<PackageReference Include="Serilog.Enrichers.Environment" Version="3.0.1" />
24+
<PackageReference Include="Serilog.Enrichers.Process" Version="3.0.0" />
25+
<PackageReference Include="Serilog.Enrichers.Thread" Version="4.0.0" />
3126
</ItemGroup>
3227

3328
<ItemGroup>

0 commit comments

Comments
 (0)