Skip to content

Commit 653f3ca

Browse files
authored
Merge branch 'master' into trace-and-span-ids
2 parents 4326fa9 + 05dff48 commit 653f3ca

File tree

7 files changed

+13
-12
lines changed

7 files changed

+13
-12
lines changed

PingPonger/PingPonger.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
55
<TargetFramework>net9.0</TargetFramework>
6+
<Nullable>enable</Nullable>
67
</PropertyGroup>
78
<ItemGroup>
89
<PackageReference Include="Serilog.Sinks.ColoredConsole" Version="3.0.1"/>

PingPonger/Program.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ internal class Options
2121

2222
[Option('i', "ip", Required = false,
2323
HelpText = "IP to send to")]
24-
public string IP { get; set; }
24+
public string? IP { get; set; }
2525

2626
[Option('l', "url", Required = false,
2727
HelpText = "URL to send to")]
28-
public string Url { get; set; }
28+
public string? Url { get; set; }
2929

3030
[Option('p', "port", Required = false,
3131
HelpText = "the Port to send to")]
@@ -60,7 +60,7 @@ public static int Main(string[] args)
6060

6161
logConfig.WriteTo.ColoredConsole();
6262

63-
if (options.Url.Length > 0)
63+
if (options.Url?.Length > 0)
6464
{
6565
if (options.UDP)
6666
{
@@ -71,10 +71,9 @@ public static int Main(string[] args)
7171
logConfig.WriteTo.TCPSink(options.Url, options.Port, null, null, new LogstashJsonFormatter());
7272
}
7373
}
74-
else if (options.IP.Length > 0)
74+
else if (options.IP?.Length > 0)
7575
{
76-
IPAddress ipAddress;
77-
if (!IPAddress.TryParse(options.IP, out ipAddress))
76+
if (!IPAddress.TryParse(options.IP, out var ipAddress))
7877
{
7978
Console.WriteLine("Could not parse " + options.IP + " as an IP address");
8079
return 1;

Serilog.Sinks.Network.Test/JsonFormatter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace Serilog.Sinks.Network.Test
1616
public class JsonFormatter
1717
{
1818
private static LoggerAndSocket ConfigureTestLogger(
19-
ITextFormatter formatter = null,
19+
ITextFormatter? formatter = null,
2020
ILogEventEnricher[] enrichers = null
2121
)
2222
{

Serilog.Sinks.Network.Test/Serilog.Sinks.Network.Test.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<PropertyGroup>
44
<TargetFramework>net6.0</TargetFramework>
55
<LangVersion>Preview</LangVersion>
6+
<Nullable>enable</Nullable>
67
</PropertyGroup>
78
<ItemGroup>
89
<PackageReference Include="Serilog.Formatting.Compact" Version="3.0.0" />

Serilog.Sinks.Network.Test/WhenLoggingViaTcp.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace Serilog.Sinks.Network.Test
1515
{
1616
public class WhenLoggingViaTcp
1717
{
18-
private static LoggerAndSocket ConfigureTestLogger(ITextFormatter formatter = null)
18+
private static LoggerAndSocket ConfigureTestLogger(ITextFormatter? formatter = null)
1919
{
2020
var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
2121
socket.Bind(new IPEndPoint(IPAddress.Loopback, 0));
@@ -66,7 +66,7 @@ public async Task CanLogWithProperties()
6666
using var fixture = ConfigureTestLogger();
6767
fixture.Logger.Information("TCP Hello {location}", "world");
6868
var receivedData = await ServerPoller.PollForReceivedData(fixture.Socket);
69-
dynamic payload = JsonConvert.DeserializeObject<ExpandoObject>(receivedData);
69+
dynamic? payload = JsonConvert.DeserializeObject<ExpandoObject>(receivedData);
7070
if (payload == null)
7171
{
7272
throw new AssertionFailedException("expected payload not null");

Serilog.Sinks.Network.Test/WhenLoggingViaUdp.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace Serilog.Sinks.Network.Test
1515
{
1616
public class WhenLoggingViaUdp
1717
{
18-
private static LoggerAndSocket ConfigureTestLogger(ITextFormatter formatter = null)
18+
private static LoggerAndSocket ConfigureTestLogger(ITextFormatter? formatter = null)
1919
{
2020
var socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
2121
socket.Bind(new IPEndPoint(IPAddress.Loopback, 0));

Serilog.Sinks.Network/Sinks/TCP/TCPSocketWriter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ private async Task Run(Func<Task<Stream?>> tryOpenStream)
206206
}
207207
}
208208

209-
private async Task FlushQueue(string entry)
209+
private async Task FlushQueue(string? entry)
210210
{
211211
while (_eventQueue.Count > 0)
212212
{
@@ -285,7 +285,7 @@ public class ExponentialBackoffTcpReconnectionPolicy
285285
{
286286
private const int Ceiling = 10 * 60; // 10 minutes in seconds
287287

288-
public static async Task<Stream> ConnectAsync(Func<Uri, Task<Stream>> connect, Uri host,
288+
public static async Task<Stream?> ConnectAsync(Func<Uri, Task<Stream>> connect, Uri host,
289289
CancellationToken cancellationToken)
290290
{
291291
int delay = 1; // in seconds

0 commit comments

Comments
 (0)