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

Upgrade packages #46

Merged
merged 10 commits into from
Mar 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
36 changes: 36 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CI

on:
push:
branches:
- master
pull_request:
branches:
- master

env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true

jobs:
build-and-test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4

- name: Restore dependencies
run: dotnet restore

- name: Build solution
run: dotnet build --configuration Release --no-restore

- name: Run tests
run: dotnet test --configuration Release --no-build
3 changes: 1 addition & 2 deletions PingPonger/PingPonger.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm so far outside of the dot net ecosystem...

is this a breaking change for folk using older versions of .Net?

(i.e. they won't be able to include it any more)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not against a version bump, just don't want to bump unnecessarily :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is not part of the actual shipped library, so it doesn't matter much. I chose the latest SDK since it's just a sample. I had to upgrade since netcoreapp1.1 has been deprecated for years now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, it's the ponger 🙈

</PropertyGroup>
<ItemGroup>
<PackageReference Include="Serilog" Version="2.5.0"/>
<PackageReference Include="Serilog.Sinks.ColoredConsole" Version="3.0.1"/>
<PackageReference Include="CommandLineParser" Version="2.1.1-beta"/>
</ItemGroup>
Expand Down
2 changes: 0 additions & 2 deletions Serilog.Sinks.Network.Test/JsonFormatter.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using System;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using FluentAssertions;
using Serilog.Core;
using Serilog.Formatting;
Expand Down
14 changes: 9 additions & 5 deletions Serilog.Sinks.Network.Test/Serilog.Sinks.Network.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Serilog.Formatting.Compact" Version="3.0.0" />
<PackageReference Include="xunit" Version="2.3.0-beta2-build3683" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="FluentAssertions" Version="4.19.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="FluentAssertions" Version="7.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.0-beta2-build3683" />
</ItemGroup>
<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions Serilog.Sinks.Network.Test/ServerPoller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ public static string PollForReceivedData(DataReceiver dataReceiver)
while (string.IsNullOrEmpty(receivedData))
{
receivedData = dataReceiver.ReceivedData.SingleOrDefault();
if (stopwatch.Elapsed > TimeSpan.FromSeconds(3))
if (stopwatch.Elapsed > TimeSpan.FromSeconds(5))
{
throw new NoDataReceivedWithinThreeSeconds();
throw new NoDataReceivedWithinFiveSeconds();
}
}

return receivedData;
}
}

internal class NoDataReceivedWithinThreeSeconds : Exception
internal class NoDataReceivedWithinFiveSeconds : Exception
{
}
}
1 change: 0 additions & 1 deletion Serilog.Sinks.Network.Test/TcpServer.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Threading.Tasks;
Expand Down
16 changes: 4 additions & 12 deletions Serilog.Sinks.Network.Test/WhenLoggingViaTCP.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Dynamic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
using System.Reflection.Metadata.Ecma335;
using System.Threading;
using System.Threading.Tasks;
using FluentAssertions;
using Newtonsoft.Json;
using Serilog.Formatting;
using Serilog.Formatting.Raw;
using Serilog.Formatting.Compact;
using Serilog.Sinks.Network.Formatters;
using Xunit;

Expand Down Expand Up @@ -59,11 +51,11 @@ public void CanLogHelloWorld_WithDefaultFormatter()
[Fact]
public void CanLogHelloWorld_WithRawFormatter()
{
ConfigureTestLogger(new RawFormatter());
var arbitraryMessage = nameof(WhenLoggingViaTCP) + "CanLogHelloWorld_WithRawFormatter" + Guid.NewGuid();
ConfigureTestLogger(new CompactJsonFormatter());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question (from ignorance on my part here) does this change the format of the message significantly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does change things a bit, but it still has no impact on the end-users. The RawFormatter is deprecated, so I replaced it. However, end-users can continue to use RawFormatter if they prefer. In this test case, the output is slightly different, but overall, I believe everything still works as expected.

var arbitraryMessage = nameof(WhenLoggingViaTCP) + "CanLogHelloWorld_WithCompactJsonFormatter" + Guid.NewGuid();
_logger.Information(arbitraryMessage);
var receivedData = ServerPoller.PollForReceivedData(_server);
receivedData.Should().Contain($"Information: \"{arbitraryMessage}\"");
receivedData.Should().Contain($"\"{arbitraryMessage}\"");
}

[Fact]
Expand Down
8 changes: 4 additions & 4 deletions Serilog.Sinks.Network.Test/WhenLoggingViaUDP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using FluentAssertions;
using Newtonsoft.Json;
using Serilog.Formatting;
using Serilog.Formatting.Raw;
using Serilog.Formatting.Compact;
using Serilog.Sinks.Network.Formatters;
using Xunit;

Expand Down Expand Up @@ -51,15 +51,15 @@ public void CanLogHelloWorld_WithRawFormatter()
{
#pragma warning disable 618
// specifically testing the deprecated RawFormatter
ConfigureTestLogger(new RawFormatter());
ConfigureTestLogger(new CompactJsonFormatter());
#pragma warning restore 618

var arbitraryMessage = nameof(WhenLoggingViaUDP) + "CanLogHelloWorld_WithRawFormatter" + Guid.NewGuid();
var arbitraryMessage = nameof(WhenLoggingViaUDP) + "CanLogHelloWorld_WithCompactJsonFormatter" + Guid.NewGuid();
_logger.Information(arbitraryMessage);
var receivedData = ServerPoller.PollForReceivedData(_listener);


receivedData.Should().Contain($"Information: \"{arbitraryMessage}\"");
receivedData.Should().Contain($"\"{arbitraryMessage}\"");
}

[Fact]
Expand Down
6 changes: 2 additions & 4 deletions Serilog.Sinks.Network/Serilog.Sinks.Network.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard1.3</TargetFrameworks>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -11,8 +11,6 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Serilog" Version="2.5.0"/>
<PackageReference Include="System.Net.NameResolution" Version="4.3.0"/>
<PackageReference Include="System.Net.Security" Version="4.3.1"/>
<PackageReference Include="Serilog" Version="2.9.0"/>
</ItemGroup>
</Project>
1 change: 0 additions & 1 deletion Serilog.Sinks.Network/Sinks/TCP/TCPSink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using Serilog.Core;
using Serilog.Events;
using Serilog.Formatting;
using Serilog.Sinks.Network.Formatters;

namespace Serilog.Sinks.Network.Sinks.TCP
{
Expand Down
3 changes: 0 additions & 3 deletions Serilog.Sinks.Network/Sinks/TCP/TCPSocketWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@
using System;
using System.Collections.Concurrent;
using System.IO;
using System.Net;
using System.Net.Security;
using System.Net.Sockets;
using System.Security.Authentication;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;

Expand Down
2 changes: 0 additions & 2 deletions Serilog.Sinks.Network/Sinks/UDP/UDPSink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
using Serilog.Core;
using Serilog.Events;
using Serilog.Formatting;
using Serilog.Formatting.Json;
using Serilog.Sinks.Network.Formatters;

namespace Serilog.Sinks.Network.Sinks.UDP
{
Expand Down
6 changes: 6 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"sdk": {
"version": "9.0.102",
"rollForward": "latestMinor"
}
}