Skip to content
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

Update SDK and targets to match Serilog 3 #54

Merged
merged 27 commits into from Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ce1e8ee
Remove publishing step to clear build failure
nblumhardt Jul 5, 2016
06e18e4
Reenable publishing [Skip CI]
nblumhardt Jul 5, 2016
b81d6f3
Merge pull request #30 from serilog/dev
nblumhardt Oct 17, 2019
b7b9ef9
supported targets: netstandard2.0, net6.0
Jul 6, 2023
ae9b27a
add argument CultureInfo.InvariantCulture to force consistent formatt…
Jul 6, 2023
b0adbda
PackageIconUrl is deprecated, added serilog-extension-nuget.png to lo…
Jul 6, 2023
6eb8935
updated formatting benchmark
Jul 6, 2023
973c40f
restored global.json, SDK 7.0.300
Jul 6, 2023
5ad414d
SDK version 7.0.8
Jul 6, 2023
f93b3df
AppVeyor SDK 7.0.304
Jul 6, 2023
4f35478
replaced Build.ps1 with adapted Build.ps1 from serilog project
Jul 6, 2023
b7b063d
test proj, removed obsolete Condition for TargetFramework net452
Jul 6, 2023
1df7654
add TargetFrameworks
Jul 10, 2023
03442a3
removed duplicate PackageIcon
Jul 10, 2023
271192c
removed AssemblyName, PackageId and Title from csproj - all are corre…
Jul 10, 2023
e338b0c
add target frameworks in test proj
Jul 10, 2023
011908d
from build.ps1 removed commented out code
Jul 10, 2023
c6f1da8
just sorted target fw's in csproj
Jul 10, 2023
f8d768f
csproj, package icon is right above commented out (and obsolete) pack…
Jul 10, 2023
6174c3c
csproj, package icon is right above commented out (and obsolete) pack…
Jul 10, 2023
cd3543f
test csproj, add missing PackageReference to "Newtonsoft.Json"
Jul 10, 2023
1d7e11b
Use less confusing name for rendered `JsonFormatter` in the benchmark…
Jul 11, 2023
29f02b3
merged 468c6435, add link to analoogy log viewer in README.md
Jul 11, 2023
0f63aeb
merged ad35ff5f, Simplify description of Analogy CLEF parser
Jul 11, 2023
eaf995e
merged 1eca9e52, README formatting tidy-up; alphabetically sort tools…
Jul 11, 2023
8d584ca
merged 8393e0ab, Update publishing key
Jul 11, 2023
2e30b05
Merge branch 'dev' into devNet6
nblumhardt Jul 19, 2023
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
40 changes: 23 additions & 17 deletions Build.ps1
Original file line number Diff line number Diff line change
@@ -1,29 +1,35 @@
Write-Output "build: Build started"

Push-Location $PSScriptRoot

if(Test-Path .\artifacts) { Remove-Item .\artifacts -Force -Recurse }
if(Test-Path .\artifacts) {
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) }[$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 ""]

$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];
$suffix = @{ $true = ""; $false = "$branch-$revision"}[$branch -eq "master" -and $revision -ne "local"]
Write-Output "build: Package version suffix is $suffix"
Write-Output "build: Build version suffix is $buildSuffix"

foreach ($src in ls src/Serilog.*) {
Push-Location $src
& dotnet build --configuration Release --version-suffix=$buildSuffix /p:ContinuousIntegrationBuild=true

& dotnet pack -c Release -o ..\..\.\artifacts --version-suffix=$suffix
if($LASTEXITCODE -ne 0) { exit 1 }
if($LASTEXITCODE -ne 0) { throw 'build failed' }

Pop-Location
if($suffix) {
& dotnet pack src\Serilog.Formatting.Compact --configuration Release --no-build --no-restore -o artifacts --version-suffix=$suffix
} else {
& dotnet pack src\Serilog.Formatting.Compact --configuration Release --no-build --no-restore -o artifacts
}

foreach ($test in ls test/Serilog.*.Tests) {
Push-Location $test
if($LASTEXITCODE -ne 0) { throw 'pack failed' }

& dotnet test -c Release
if($LASTEXITCODE -ne 0) { exit 2 }
Write-Output "build: Testing"

Pop-Location
}
& dotnet test test\Serilog.Formatting.Compact.Tests --configuration Release --no-build --no-restore

Pop-Location
if($LASTEXITCODE -ne 0) { throw 'unit tests failed' }
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
supported targets: netstandard2.0, net6.0
updated packages in test proj
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,3 @@ Several tools are available for working with the CLEF format.
* **[Compact Log Format Viewer](https://github.com/warrenbuckley/Compact-Log-Format-Viewer)** - a cross-platform viewer for CLEF files
* **[`seqcli`](https://github.com/datalust/seqcli)** - pretty-`print` CLEF files at the command-line, or `ingest` CLEF files into [Seq](https://datalust.co/seq) for search, and analysis
* **[_Serilog.Formatting.Compact.Reader_](https://github.com/serilog/serilog-formatting-compact-reader)** - convert CLEF documents back into Serilog `LogEvent`s

2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ install:
- ps: ./Setup.ps1
build_script:
- ps: ./Build.ps1
test: off
test: false
artifacts:
- path: artifacts/Serilog.*.nupkg
deploy:
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sdk": {
"version": "3.0.100"
"version": "7.0.304"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

using System;
using System.Globalization;
using System.IO;
using System.Linq;
using Serilog.Events;
Expand Down Expand Up @@ -76,12 +77,12 @@ public static void FormatEvent(LogEvent logEvent, TextWriter output, JsonValueFo
{
output.Write(",\"@r\":[");
var delim = "";
foreach (var r in tokensWithFormat)
foreach (PropertyToken r in tokensWithFormat)
{
output.Write(delim);
delim = ",";
var space = new StringWriter();
r.Render(logEvent.Properties, space);
r.Render(logEvent.Properties, space, CultureInfo.InvariantCulture);
JsonValueFormatter.WriteQuotedJsonString(space.ToString(), output);
}
output.Write(']');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

using System;
using System.Globalization;
using System.IO;
using Serilog.Events;
using Serilog.Formatting.Json;
Expand Down Expand Up @@ -63,11 +64,11 @@ public static void FormatEvent(LogEvent logEvent, TextWriter output, JsonValueFo
output.Write("{\"@t\":\"");
output.Write(logEvent.Timestamp.UtcDateTime.ToString("O"));
output.Write("\",\"@m\":");
var message = logEvent.MessageTemplate.Render(logEvent.Properties);
var message = logEvent.MessageTemplate.Render(logEvent.Properties, CultureInfo.InvariantCulture);
JsonValueFormatter.WriteQuotedJsonString(message, output);
output.Write(",\"@i\":\"");
var id = EventIdHash.Compute(logEvent.MessageTemplate.Text);
output.Write(id.ToString("x8"));
output.Write(id.ToString("x8",CultureInfo.InvariantCulture));
output.Write('"');

if (logEvent.Level != LogEventLevel.Information)
Expand Down
51 changes: 27 additions & 24 deletions src/Serilog.Formatting.Compact/Serilog.Formatting.Compact.csproj
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Description>A simple, compact JSON-based event format for Serilog.</Description>
<VersionPrefix>1.1.1</VersionPrefix>
<Authors>Serilog Contributors</Authors>
<TargetFrameworks>net452;netstandard1.1;netstandard2.0</TargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyName>Serilog.Formatting.Compact</AssemblyName>
<AssemblyOriginatorKeyFile>../../assets/Serilog.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<PackageId>Serilog.Formatting.Compact</PackageId>
<PackageTags>serilog;json</PackageTags>
<PackageIconUrl>http://serilog.net/images/serilog-extension-nuget.png</PackageIconUrl>
<PackageProjectUrl>https://github.com/serilog/serilog-formatting-compact</PackageProjectUrl>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
</PropertyGroup>
<PropertyGroup>
<Description>A simple, compact JSON-based event format for Serilog.</Description>
<VersionPrefix>2.0.0</VersionPrefix>
<Authors>Serilog Contributors</Authors>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT'">net462;net471</TargetFrameworks>
<TargetFrameworks>$(TargetFrameworks);netstandard2.0;netstandard2.1;net6.0;net7.0</TargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyOriginatorKeyFile>../../assets/Serilog.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<PackageIcon>serilog-extension-nuget.png</PackageIcon>
<PackageTags>serilog;json</PackageTags>
<PackageProjectUrl>https://github.com/serilog/serilog-formatting-compact</PackageProjectUrl>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<RepositoryUrl>https://github.com/serilog/serilog-formatting-compact</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<AnalysisLevel>6.0-recommended</AnalysisLevel>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Serilog" Version="2.9.0" />
</ItemGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='netstandard2.0'">
<WarningLevel>5</WarningLevel>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Serilog" Version="3.0.1" />
<None Include="serilog-extension-nuget.png" Pack="True" Visible="False" PackagePath="" />
</ItemGroup>

</Project>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public FormattingBenchmarks()

StringWriter _buffer;

[Setup]
[GlobalSetup]
public void InitBuffer()
{
_buffer = new StringWriter();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class FormattingBenchmarksConfig : ManualConfig
{
public FormattingBenchmarksConfig()
{
this.Add(Job.Default.WithTargetCount(new Count(10)));
this.AddJob(Job.Default.WithIterationCount(10));
}
}
}
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net452;netcoreapp2.1</TargetFrameworks>
<AssemblyName>Serilog.Formatting.Compact.Tests</AssemblyName>
<AssemblyOriginatorKeyFile>../../assets/Serilog.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<IsPackable>false</IsPackable>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT'">net462;net48</TargetFrameworks>
<TargetFrameworks>$(TargetFrameworks);netcoreapp3.1;net6.0;net7.0;</TargetFrameworks>
<AssemblyName>Serilog.Formatting.Compact.Tests</AssemblyName>
<AssemblyOriginatorKeyFile>../../assets/Serilog.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<IsPackable>false</IsPackable>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
<PackageReference Include="BenchmarkDotNet" Version="0.9.7-beta" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.5" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Serilog.Formatting.Compact\Serilog.Formatting.Compact.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Serilog.Formatting.Compact\Serilog.Formatting.Compact.csproj" />
</ItemGroup>

</Project>