Skip to content
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
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<ItemGroup>
<PackageVersion Include="coverlet.msbuild" Version="6.0.2" />
<PackageVersion Include="GitHubActionsTestLogger" Version="2.3.3" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.0-preview.3.24172.13" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.0-preview.4.24267.6" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageVersion Include="NSubstitute" Version="5.1.0" />
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "9.0.100-preview.3.24204.13",
"version": "9.0.100-preview.4.24267.66",
"allowPrerelease": false,
"rollForward": "latestMajor"
}
Expand Down
11 changes: 11 additions & 0 deletions src/Logging.XUnit/CompatibilitySuppressions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- https://learn.microsoft.com/en-us/dotnet/fundamentals/package-validation/diagnostic-ids -->
<Suppressions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Suppression>
<DiagnosticId>CP0021</DiagnosticId>
<Target>M:MartinCostello.Logging.XUnit.XUnitLogger.BeginScope``1(``0)``0:notnull</Target>
<Left>lib/netstandard2.0/MartinCostello.Logging.XUnit.dll</Left>
<Right>lib/netstandard2.0/MartinCostello.Logging.XUnit.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
</Suppressions>
16 changes: 11 additions & 5 deletions tests/Logging.XUnit.Tests/XUnitLoggerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,8 @@ public static void XUnitLogger_Log_Logs_Message_If_Only_Exception()

string expected = string.Join(
Environment.NewLine,
["[2018-08-19 16:12:16Z] info: MyName[2]", "System.InvalidOperationException: Invalid"]);
"[2018-08-19 16:12:16Z] info: MyName[2]",
"System.InvalidOperationException: Invalid");

// Act
logger.Log(LogLevel.Information, new EventId(2), "state", exception, FormatterNull);
Expand Down Expand Up @@ -317,7 +318,9 @@ public static void XUnitLogger_Log_Logs_Message_If_Message_And_Exception()

string expected = string.Join(
Environment.NewLine,
["[2018-08-19 16:12:16Z] warn: MyName[3]", " Message|False|True", "System.InvalidOperationException: Invalid"]);
"[2018-08-19 16:12:16Z] warn: MyName[3]",
" Message|False|True",
"System.InvalidOperationException: Invalid");

// Act
logger.Log<string?>(LogLevel.Warning, new EventId(3), null, exception, Formatter);
Expand Down Expand Up @@ -345,7 +348,8 @@ public static void XUnitLogger_Log_Logs_Message_If_Message_And_No_Exception()

string expected = string.Join(
Environment.NewLine,
["[2018-08-19 16:12:16Z] fail: MyName[4]", " Message|False|False"]);
"[2018-08-19 16:12:16Z] fail: MyName[4]",
" Message|False|False");

// Act
logger.Log<string?>(LogLevel.Error, new EventId(4), null, null, Formatter);
Expand Down Expand Up @@ -379,7 +383,8 @@ public static void XUnitLogger_Log_Logs_Messages(LogLevel logLevel, string short

string expected = string.Join(
Environment.NewLine,
[$"[2018-08-19 16:12:16Z] {shortLevel}: Your Name[85]", " Message|True|False"]);
$"[2018-08-19 16:12:16Z] {shortLevel}: Your Name[85]",
" Message|True|False");

// Act
logger.Log(logLevel, new EventId(85), "Martin", null, Formatter);
Expand Down Expand Up @@ -429,7 +434,8 @@ public static void XUnitLogger_Log_Logs_Message_If_Scopes_Included_But_There_Are

string expected = string.Join(
Environment.NewLine,
["[2018-08-19 16:12:16Z] info: MyName[0]", " Message|False|False"]);
"[2018-08-19 16:12:16Z] info: MyName[0]",
" Message|False|False");

// Act
logger.Log<string?>(LogLevel.Information, 0, null, null, Formatter);
Expand Down