File tree Expand file tree Collapse file tree 13 files changed +65
-39
lines changed
Serilog.Sinks.Network.Test Expand file tree Collapse file tree 13 files changed +65
-39
lines changed Original file line number Diff line number Diff line change
1
+ name : CI
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - master
7
+ pull_request :
8
+ branches :
9
+ - master
10
+
11
+ env :
12
+ DOTNET_SKIP_FIRST_TIME_EXPERIENCE : true
13
+ DOTNET_CLI_TELEMETRY_OPTOUT : true
14
+
15
+ jobs :
16
+ build-and-test :
17
+ strategy :
18
+ matrix :
19
+ os : [ubuntu-latest, windows-latest, macOS-latest]
20
+ runs-on : ${{ matrix.os }}
21
+
22
+ steps :
23
+ - name : Checkout code
24
+ uses : actions/checkout@v4
25
+
26
+ - name : Setup .NET
27
+ uses : actions/setup-dotnet@v4
28
+
29
+ - name : Restore dependencies
30
+ run : dotnet restore
31
+
32
+ - name : Build solution
33
+ run : dotnet build --configuration Release --no-restore
34
+
35
+ - name : Run tests
36
+ run : dotnet test --configuration Release --no-build
Original file line number Diff line number Diff line change 2
2
<Project Sdk =" Microsoft.NET.Sdk" >
3
3
<PropertyGroup >
4
4
<OutputType >Exe</OutputType >
5
- <TargetFramework >netcoreapp1.1 </TargetFramework >
5
+ <TargetFramework >net9.0 </TargetFramework >
6
6
</PropertyGroup >
7
7
<ItemGroup >
8
- <PackageReference Include =" Serilog" Version =" 2.5.0" />
9
8
<PackageReference Include =" Serilog.Sinks.ColoredConsole" Version =" 3.0.1" />
10
9
<PackageReference Include =" CommandLineParser" Version =" 2.1.1-beta" />
11
10
</ItemGroup >
Original file line number Diff line number Diff line change 1
1
using System ;
2
- using System . Linq ;
3
2
using System . Net ;
4
- using System . Threading . Tasks ;
5
3
using FluentAssertions ;
6
4
using Serilog . Core ;
7
5
using Serilog . Formatting ;
Original file line number Diff line number Diff line change 1
1
<?xml version =" 1.0" encoding =" utf-8" standalone =" yes" ?>
2
2
<Project Sdk =" Microsoft.NET.Sdk" >
3
3
<PropertyGroup >
4
- <TargetFramework >netcoreapp1.1 </TargetFramework >
4
+ <TargetFramework >net9.0 </TargetFramework >
5
5
</PropertyGroup >
6
6
<ItemGroup >
7
+ <PackageReference Include =" Serilog.Formatting.Compact" Version =" 3.0.0" />
7
8
<PackageReference Include =" xunit" Version =" 2.3.0-beta2-build3683" />
8
- <PackageReference Include =" Newtonsoft.Json" Version =" 10.0.3" />
9
- <PackageReference Include =" FluentAssertions" Version =" 4.19.3" />
10
- <PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" 15.3.0" />
11
- <PackageReference Include =" xunit.runner.visualstudio" Version =" 2.2.0" />
9
+ <PackageReference Include =" Newtonsoft.Json" Version =" 13.0.3" />
10
+ <PackageReference Include =" FluentAssertions" Version =" 7.2.0" />
11
+ <PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" 17.13.0" />
12
+ <PackageReference Include =" xunit.runner.visualstudio" Version =" 3.0.2" >
13
+ <PrivateAssets >all</PrivateAssets >
14
+ <IncludeAssets >runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets >
15
+ </PackageReference >
12
16
<DotNetCliToolReference Include =" dotnet-xunit" Version =" 2.3.0-beta2-build3683" />
13
17
</ItemGroup >
14
18
<ItemGroup >
Original file line number Diff line number Diff line change @@ -13,17 +13,17 @@ public static string PollForReceivedData(DataReceiver dataReceiver)
13
13
while ( string . IsNullOrEmpty ( receivedData ) )
14
14
{
15
15
receivedData = dataReceiver . ReceivedData . SingleOrDefault ( ) ;
16
- if ( stopwatch . Elapsed > TimeSpan . FromSeconds ( 3 ) )
16
+ if ( stopwatch . Elapsed > TimeSpan . FromSeconds ( 5 ) )
17
17
{
18
- throw new NoDataReceivedWithinThreeSeconds ( ) ;
18
+ throw new NoDataReceivedWithinFiveSeconds ( ) ;
19
19
}
20
20
}
21
21
22
22
return receivedData ;
23
23
}
24
24
}
25
25
26
- internal class NoDataReceivedWithinThreeSeconds : Exception
26
+ internal class NoDataReceivedWithinFiveSeconds : Exception
27
27
{
28
28
}
29
29
}
Original file line number Diff line number Diff line change 1
1
using System ;
2
2
using System . Collections . Generic ;
3
- using System . IO ;
4
3
using System . Net ;
5
4
using System . Net . Sockets ;
6
5
using System . Threading . Tasks ;
Original file line number Diff line number Diff line change 1
1
using System ;
2
- using System . Collections . Generic ;
3
- using System . Diagnostics ;
4
2
using System . Dynamic ;
5
- using System . Linq ;
6
3
using System . Net ;
7
- using System . Net . Sockets ;
8
- using System . Reflection ;
9
- using System . Reflection . Metadata . Ecma335 ;
10
- using System . Threading ;
11
- using System . Threading . Tasks ;
12
4
using FluentAssertions ;
13
5
using Newtonsoft . Json ;
14
6
using Serilog . Formatting ;
15
- using Serilog . Formatting . Raw ;
7
+ using Serilog . Formatting . Compact ;
16
8
using Serilog . Sinks . Network . Formatters ;
17
9
using Xunit ;
18
10
@@ -59,11 +51,11 @@ public void CanLogHelloWorld_WithDefaultFormatter()
59
51
[ Fact ]
60
52
public void CanLogHelloWorld_WithRawFormatter ( )
61
53
{
62
- ConfigureTestLogger ( new RawFormatter ( ) ) ;
63
- var arbitraryMessage = nameof ( WhenLoggingViaTCP ) + "CanLogHelloWorld_WithRawFormatter " + Guid . NewGuid ( ) ;
54
+ ConfigureTestLogger ( new CompactJsonFormatter ( ) ) ;
55
+ var arbitraryMessage = nameof ( WhenLoggingViaTCP ) + "CanLogHelloWorld_WithCompactJsonFormatter " + Guid . NewGuid ( ) ;
64
56
_logger . Information ( arbitraryMessage ) ;
65
57
var receivedData = ServerPoller . PollForReceivedData ( _server ) ;
66
- receivedData . Should ( ) . Contain ( $ "Information: \" { arbitraryMessage } \" ") ;
58
+ receivedData . Should ( ) . Contain ( $ "\" { arbitraryMessage } \" ") ;
67
59
}
68
60
69
61
[ Fact ]
Original file line number Diff line number Diff line change 4
4
using FluentAssertions ;
5
5
using Newtonsoft . Json ;
6
6
using Serilog . Formatting ;
7
- using Serilog . Formatting . Raw ;
7
+ using Serilog . Formatting . Compact ;
8
8
using Serilog . Sinks . Network . Formatters ;
9
9
using Xunit ;
10
10
@@ -51,15 +51,15 @@ public void CanLogHelloWorld_WithRawFormatter()
51
51
{
52
52
#pragma warning disable 618
53
53
// specifically testing the deprecated RawFormatter
54
- ConfigureTestLogger ( new RawFormatter ( ) ) ;
54
+ ConfigureTestLogger ( new CompactJsonFormatter ( ) ) ;
55
55
#pragma warning restore 618
56
56
57
- var arbitraryMessage = nameof ( WhenLoggingViaUDP ) + "CanLogHelloWorld_WithRawFormatter " + Guid . NewGuid ( ) ;
57
+ var arbitraryMessage = nameof ( WhenLoggingViaUDP ) + "CanLogHelloWorld_WithCompactJsonFormatter " + Guid . NewGuid ( ) ;
58
58
_logger . Information ( arbitraryMessage ) ;
59
59
var receivedData = ServerPoller . PollForReceivedData ( _listener ) ;
60
60
61
61
62
- receivedData . Should ( ) . Contain ( $ "Information: \" { arbitraryMessage } \" ") ;
62
+ receivedData . Should ( ) . Contain ( $ "\" { arbitraryMessage } \" ") ;
63
63
}
64
64
65
65
[ Fact ]
Original file line number Diff line number Diff line change 1
1
<?xml version =" 1.0" encoding =" UTF-8" standalone =" yes" ?>
2
2
<Project Sdk =" Microsoft.NET.Sdk" >
3
3
<PropertyGroup >
4
- <TargetFrameworks >netstandard1.3</ TargetFrameworks >
4
+ <TargetFramework >netstandard2.0</ TargetFramework >
5
5
</PropertyGroup >
6
6
7
7
<PropertyGroup >
11
11
</PropertyGroup >
12
12
13
13
<ItemGroup >
14
- <PackageReference Include =" Serilog" Version =" 2.5.0" />
15
- <PackageReference Include =" System.Net.NameResolution" Version =" 4.3.0" />
16
- <PackageReference Include =" System.Net.Security" Version =" 4.3.1" />
14
+ <PackageReference Include =" Serilog" Version =" 2.9.0" />
17
15
</ItemGroup >
18
16
</Project >
Original file line number Diff line number Diff line change 5
5
using Serilog . Core ;
6
6
using Serilog . Events ;
7
7
using Serilog . Formatting ;
8
- using Serilog . Sinks . Network . Formatters ;
9
8
10
9
namespace Serilog . Sinks . Network . Sinks . TCP
11
10
{
Original file line number Diff line number Diff line change 17
17
using System ;
18
18
using System . Collections . Concurrent ;
19
19
using System . IO ;
20
- using System . Net ;
21
20
using System . Net . Security ;
22
21
using System . Net . Sockets ;
23
- using System . Security . Authentication ;
24
22
using System . Text ;
25
- using System . Text . RegularExpressions ;
26
23
using System . Threading ;
27
24
using System . Threading . Tasks ;
28
25
Original file line number Diff line number Diff line change 6
6
using Serilog . Core ;
7
7
using Serilog . Events ;
8
8
using Serilog . Formatting ;
9
- using Serilog . Formatting . Json ;
10
- using Serilog . Sinks . Network . Formatters ;
11
9
12
10
namespace Serilog . Sinks . Network . Sinks . UDP
13
11
{
Original file line number Diff line number Diff line change
1
+ {
2
+ "sdk" : {
3
+ "version" : " 9.0.102" ,
4
+ "rollForward" : " latestMinor"
5
+ }
6
+ }
You can’t perform that action at this time.
0 commit comments