Skip to content

Commit

Permalink
Update packages and test under net8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ltrzesniewski committed Dec 6, 2023
1 parent d427ba0 commit 7cb322c
Show file tree
Hide file tree
Showing 12 changed files with 1,144 additions and 64 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ jobs:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x

- name: Restore
run: dotnet restore src/ZeroLog.sln
Expand Down
5 changes: 2 additions & 3 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<LangVersion>11.0</LangVersion>
<LangVersion>12.0</LangVersion>
<Prefer32Bit>false</Prefer32Bit>
<DefaultItemExcludes>$(DefaultItemExcludes);*.DotSettings;*.ncrunchproject</DefaultItemExcludes>
<DebugType>embedded</DebugType>
Expand Down Expand Up @@ -34,8 +34,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2022.3.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="all" />
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" PrivateAssets="all" />
</ItemGroup>

</Project>
10 changes: 5 additions & 5 deletions src/ZeroLog.Analyzers.Tests/ZeroLog.Analyzers.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>

Expand All @@ -10,14 +10,14 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis" Version="4.4.0" />
<PackageReference Include="Microsoft.CodeAnalysis" Version="4.8.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing" Version="1.1.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing" Version="1.1.1" />
<PackageReference Include="Microsoft.CodeAnalysis.Testing.Verifiers.NUnit" Version="1.1.1" />

<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.3.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>

</Project>
10 changes: 5 additions & 5 deletions src/ZeroLog.Benchmarks/ZeroLog.Benchmarks.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<OutputType>Exe</OutputType>
<NoWarn>$(NoWarn);CS8002</NoWarn>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
Expand All @@ -12,13 +12,13 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.4" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.11" />
<PackageReference Include="HdrHistogram" Version="2.5.0" />
<PackageReference Include="Fody" Version="6.6.4" PrivateAssets="all" />
<PackageReference Include="Fody" Version="6.8.0" PrivateAssets="all" />
<PackageReference Include="InlineIL.Fody" Version="1.7.4" PrivateAssets="all" />
<PackageReference Include="log4net" Version="2.0.15" />
<PackageReference Include="NLog" Version="5.1.1" />
<PackageReference Include="Serilog" Version="2.12.0" />
<PackageReference Include="NLog" Version="5.2.7" />
<PackageReference Include="Serilog" Version="3.1.1" />
<PackageReference Include="System.Net.Sockets" Version="4.3.0" />
</ItemGroup>

Expand Down
12 changes: 6 additions & 6 deletions src/ZeroLog.Tests.NetStandard/ZeroLog.Tests.NetStandard.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.3.1" />
<PackageReference Include="Verify.NUnit" Version="19.9.2" />
<PackageReference Include="Verify.DiffPlex" Version="2.2.0" />
<PackageReference Include="PublicApiGenerator" Version="10.3.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="NUnit" Version="4.0.1" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="Verify.NUnit" Version="22.7.1" />
<PackageReference Include="Verify.DiffPlex" Version="2.3.0" />
<PackageReference Include="PublicApiGenerator" Version="11.1.0" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/ZeroLog.Tests/AllocationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,14 @@ public void should_not_allocate_using_all_formats_and_file_appender_builder()
allocationsOnLoggingThread = GC.GetAllocatedBytesForCurrentThread() - allocationsOnLoggingThread;
allocationsOnAppenderThread = _awaitableAppender.AllocatedBytesOnAppenderThread - allocationsOnAppenderThread;

Assert.Zero(allocationsOnLoggingThread, "Allocations on logging thread");
Assert.That(allocationsOnLoggingThread, Is.Zero, "Allocations on logging thread");

#if NET7_0_OR_GREATER
Assert.Zero(allocationsOnAppenderThread, "Allocations on appender thread");
Assert.That(allocationsOnAppenderThread, Is.Zero, "Allocations on appender thread");
#else
// .NET 6 allocates 40 bytes on the appender thread, independently of the event count.
// I don't know why, but .NET 7 doesn't exhibit this behavior anymore, so I suppose it's just some glitch.
Assert.LessOrEqual(allocationsOnAppenderThread, 40, "Allocations on appender thread");
Assert.That(allocationsOnAppenderThread, Is.LessThanOrEqualTo(40), "Allocations on appender thread");
#endif
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@
public abstract class Appender : System.IDisposable
{
protected Appender() { }
public ZeroLog.LogLevel Level { get; set; }
public ZeroLog.LogLevel Level { get; init; }
public virtual void Dispose() { }
public virtual void Flush() { }
public abstract void WriteMessage(ZeroLog.Formatting.LoggedMessage message);
}
public class ConsoleAppender : ZeroLog.Appenders.StreamAppender
{
public ConsoleAppender() { }
public bool ColorOutput { get; set; }
public bool ColorOutput { get; init; }
public override void Flush() { }
public override void WriteMessage(ZeroLog.Formatting.LoggedMessage message) { }
}
public class DateAndSizeRollingFileAppender : ZeroLog.Appenders.StreamAppender
{
public DateAndSizeRollingFileAppender(string directory) { }
public string Directory { get; }
public string FileExtension { get; set; }
public string FileNamePrefix { get; set; }
public long MaxFileSizeInBytes { get; set; }
public string FileExtension { get; init; }
public string FileNamePrefix { get; init; }
public long MaxFileSizeInBytes { get; init; }
public override void Dispose() { }
protected virtual void FileClosing() { }
protected virtual void FileOpened() { }
Expand All @@ -37,8 +37,8 @@
{
protected StreamAppender() { }
protected System.Text.Encoding Encoding { get; set; }
public ZeroLog.Formatting.Formatter Formatter { get; set; }
protected System.IO.Stream? Stream { get; set; }
public ZeroLog.Formatting.Formatter Formatter { get; init; }
public override void Dispose() { }
public override void Flush() { }
public override void WriteMessage(ZeroLog.Formatting.LoggedMessage message) { }
Expand All @@ -47,8 +47,8 @@
{
public TextWriterAppender() { }
public TextWriterAppender(System.IO.TextWriter? textWriter) { }
public ZeroLog.Formatting.Formatter Formatter { get; set; }
public System.IO.TextWriter? TextWriter { get; set; }
public ZeroLog.Formatting.Formatter Formatter { get; init; }
public override void Dispose() { }
public override void Flush() { }
public override void WriteMessage(ZeroLog.Formatting.LoggedMessage message) { }
Expand Down Expand Up @@ -102,16 +102,16 @@ namespace ZeroLog.Configuration
{
public ZeroLogConfiguration() { }
public System.TimeSpan AppenderQuarantineDelay { get; set; }
public ZeroLog.Configuration.AppendingStrategy AppendingStrategy { get; set; }
public bool AutoRegisterEnums { get; set; }
public int LogMessageBufferSize { get; set; }
public int LogMessagePoolSize { get; set; }
public int LogMessageStringCapacity { get; set; }
public ZeroLog.Configuration.ILoggerConfigurationCollection Loggers { get; }
public string NullDisplayString { get; set; }
public ZeroLog.Configuration.RootLoggerConfiguration RootLogger { get; }
public string TruncatedMessageSuffix { get; set; }
public bool UseBackgroundThread { get; set; }
public ZeroLog.Configuration.AppendingStrategy AppendingStrategy { get; init; }
public int LogMessageBufferSize { get; init; }
public int LogMessagePoolSize { get; init; }
public int LogMessageStringCapacity { get; init; }
public bool UseBackgroundThread { get; init; }
public void ApplyChanges() { }
public void SetLogLevel(string? loggerName, ZeroLog.LogLevel? logLevel) { }
public static ZeroLog.Configuration.ZeroLogConfiguration CreateTestConfiguration() { }
Expand All @@ -122,8 +122,8 @@ namespace ZeroLog.Formatting
public sealed class DefaultFormatter : ZeroLog.Formatting.Formatter
{
public DefaultFormatter() { }
public string JsonSeparator { get; set; }
public string PrefixPattern { get; set; }
public string JsonSeparator { get; init; }
public string PrefixPattern { get; init; }
protected override void WriteMessage(ZeroLog.Formatting.LoggedMessage message) { }
}
public abstract class Formatter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@
public abstract class Appender : System.IDisposable
{
protected Appender() { }
public ZeroLog.LogLevel Level { get; set; }
public ZeroLog.LogLevel Level { get; init; }
public virtual void Dispose() { }
public virtual void Flush() { }
public abstract void WriteMessage(ZeroLog.Formatting.LoggedMessage message);
}
public class ConsoleAppender : ZeroLog.Appenders.StreamAppender
{
public ConsoleAppender() { }
public bool ColorOutput { get; set; }
public bool ColorOutput { get; init; }
public override void Flush() { }
public override void WriteMessage(ZeroLog.Formatting.LoggedMessage message) { }
}
public class DateAndSizeRollingFileAppender : ZeroLog.Appenders.StreamAppender
{
public DateAndSizeRollingFileAppender(string directory) { }
public string Directory { get; }
public string FileExtension { get; set; }
public string FileNamePrefix { get; set; }
public long MaxFileSizeInBytes { get; set; }
public string FileExtension { get; init; }
public string FileNamePrefix { get; init; }
public long MaxFileSizeInBytes { get; init; }
public override void Dispose() { }
protected virtual void FileClosing() { }
protected virtual void FileOpened() { }
Expand All @@ -37,8 +37,8 @@
{
protected StreamAppender() { }
protected System.Text.Encoding Encoding { get; set; }
public ZeroLog.Formatting.Formatter Formatter { get; set; }
protected System.IO.Stream? Stream { get; set; }
public ZeroLog.Formatting.Formatter Formatter { get; init; }
public override void Dispose() { }
public override void Flush() { }
public override void WriteMessage(ZeroLog.Formatting.LoggedMessage message) { }
Expand All @@ -47,8 +47,8 @@
{
public TextWriterAppender() { }
public TextWriterAppender(System.IO.TextWriter? textWriter) { }
public ZeroLog.Formatting.Formatter Formatter { get; set; }
public System.IO.TextWriter? TextWriter { get; set; }
public ZeroLog.Formatting.Formatter Formatter { get; init; }
public override void Dispose() { }
public override void Flush() { }
public override void WriteMessage(ZeroLog.Formatting.LoggedMessage message) { }
Expand Down Expand Up @@ -102,16 +102,16 @@ namespace ZeroLog.Configuration
{
public ZeroLogConfiguration() { }
public System.TimeSpan AppenderQuarantineDelay { get; set; }
public ZeroLog.Configuration.AppendingStrategy AppendingStrategy { get; set; }
public bool AutoRegisterEnums { get; set; }
public int LogMessageBufferSize { get; set; }
public int LogMessagePoolSize { get; set; }
public int LogMessageStringCapacity { get; set; }
public ZeroLog.Configuration.ILoggerConfigurationCollection Loggers { get; }
public string NullDisplayString { get; set; }
public ZeroLog.Configuration.RootLoggerConfiguration RootLogger { get; }
public string TruncatedMessageSuffix { get; set; }
public bool UseBackgroundThread { get; set; }
public ZeroLog.Configuration.AppendingStrategy AppendingStrategy { get; init; }
public int LogMessageBufferSize { get; init; }
public int LogMessagePoolSize { get; init; }
public int LogMessageStringCapacity { get; init; }
public bool UseBackgroundThread { get; init; }
public void ApplyChanges() { }
public void SetLogLevel(string? loggerName, ZeroLog.LogLevel? logLevel) { }
public static ZeroLog.Configuration.ZeroLogConfiguration CreateTestConfiguration() { }
Expand All @@ -122,8 +122,8 @@ namespace ZeroLog.Formatting
public sealed class DefaultFormatter : ZeroLog.Formatting.Formatter
{
public DefaultFormatter() { }
public string JsonSeparator { get; set; }
public string PrefixPattern { get; set; }
public string JsonSeparator { get; init; }
public string PrefixPattern { get; init; }
protected override void WriteMessage(ZeroLog.Formatting.LoggedMessage message) { }
}
public abstract class Formatter
Expand Down
Loading

0 comments on commit 7cb322c

Please sign in to comment.