Skip to content
Draft
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
9 changes: 2 additions & 7 deletions src/JsonApiDotNetCore/QueryStrings/QueryStringReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,7 @@ public void ReadAll(DisableQueryStringAttribute? disableQueryStringAttribute)

if (reader != null)
{
if (_logger.IsEnabled(LogLevel.Debug))
{
string readerType = reader.GetType().Name;
LogParameterAccepted(parameterName, parameterValue, readerType);
}
LogParameterAccepted(parameterName, parameterValue, reader.GetType().Name);

if (!reader.AllowEmptyValue && string.IsNullOrEmpty(parameterValue))
{
Expand All @@ -78,8 +74,7 @@ public void ReadAll(DisableQueryStringAttribute? disableQueryStringAttribute)
}
}

[LoggerMessage(Level = LogLevel.Debug, SkipEnabledCheck = true,
Message = "Query string parameter '{ParameterName}' with value '{ParameterValue}' was accepted by {ReaderType}.")]
[LoggerMessage(Level = LogLevel.Debug, Message = "Query string parameter '{ParameterName}' with value '{ParameterValue}' was accepted by {ReaderType}.")]
private partial void LogParameterAccepted(string parameterName, StringValues parameterValue, string readerType);

[LoggerMessage(Level = LogLevel.Debug, Message = "Query string parameter '{ParameterName}' was successfully read.")]
Expand Down
2 changes: 0 additions & 2 deletions test/TestBuildingBlocks/XUnitLogHttpMessageHandler.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using Microsoft.Extensions.Logging;
using Xunit.Abstractions;

#pragma warning disable CA1873 // Avoid potentially expensive logging

namespace TestBuildingBlocks;

/// <summary>
Expand Down Expand Up @@ -37,11 +35,11 @@

if (!string.IsNullOrEmpty(requestBody))
{
LogRequestMessage(request.ToString(), BodySeparator, requestBody);

Check failure on line 38 in test/TestBuildingBlocks/XUnitLogHttpMessageHandler.cs

View workflow job for this annotation

GitHub Actions / build-and-test (windows-latest)

Evaluation of this argument may be expensive and unnecessary if logging is disabled (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1873)

Check failure on line 38 in test/TestBuildingBlocks/XUnitLogHttpMessageHandler.cs

View workflow job for this annotation

GitHub Actions / build-and-test (windows-latest)

Evaluation of this argument may be expensive and unnecessary if logging is disabled (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1873)

Check failure on line 38 in test/TestBuildingBlocks/XUnitLogHttpMessageHandler.cs

View workflow job for this annotation

GitHub Actions / build-and-test (macos-latest)

Evaluation of this argument may be expensive and unnecessary if logging is disabled (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1873)

Check failure on line 38 in test/TestBuildingBlocks/XUnitLogHttpMessageHandler.cs

View workflow job for this annotation

GitHub Actions / build-and-test (macos-latest)

Evaluation of this argument may be expensive and unnecessary if logging is disabled (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1873)

Check failure on line 38 in test/TestBuildingBlocks/XUnitLogHttpMessageHandler.cs

View workflow job for this annotation

GitHub Actions / build-and-test (ubuntu-latest)

Evaluation of this argument may be expensive and unnecessary if logging is disabled (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1873)

Check failure on line 38 in test/TestBuildingBlocks/XUnitLogHttpMessageHandler.cs

View workflow job for this annotation

GitHub Actions / build-and-test (ubuntu-latest)

Evaluation of this argument may be expensive and unnecessary if logging is disabled (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1873)
}
else
{
LogRequestMessage(request.ToString(), string.Empty, string.Empty);

Check failure on line 42 in test/TestBuildingBlocks/XUnitLogHttpMessageHandler.cs

View workflow job for this annotation

GitHub Actions / build-and-test (windows-latest)

Evaluation of this argument may be expensive and unnecessary if logging is disabled (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1873)

Check failure on line 42 in test/TestBuildingBlocks/XUnitLogHttpMessageHandler.cs

View workflow job for this annotation

GitHub Actions / build-and-test (windows-latest)

Evaluation of this argument may be expensive and unnecessary if logging is disabled (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1873)

Check failure on line 42 in test/TestBuildingBlocks/XUnitLogHttpMessageHandler.cs

View workflow job for this annotation

GitHub Actions / build-and-test (macos-latest)

Evaluation of this argument may be expensive and unnecessary if logging is disabled (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1873)

Check failure on line 42 in test/TestBuildingBlocks/XUnitLogHttpMessageHandler.cs

View workflow job for this annotation

GitHub Actions / build-and-test (macos-latest)

Evaluation of this argument may be expensive and unnecessary if logging is disabled (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1873)

Check failure on line 42 in test/TestBuildingBlocks/XUnitLogHttpMessageHandler.cs

View workflow job for this annotation

GitHub Actions / build-and-test (ubuntu-latest)

Evaluation of this argument may be expensive and unnecessary if logging is disabled (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1873)

Check failure on line 42 in test/TestBuildingBlocks/XUnitLogHttpMessageHandler.cs

View workflow job for this annotation

GitHub Actions / build-and-test (ubuntu-latest)

Evaluation of this argument may be expensive and unnecessary if logging is disabled (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1873)
}
}

Expand All @@ -53,11 +51,11 @@

if (!string.IsNullOrEmpty(responseBody))
{
LogResponseMessage(response.ToString(), BodySeparator, responseBody);

Check failure on line 54 in test/TestBuildingBlocks/XUnitLogHttpMessageHandler.cs

View workflow job for this annotation

GitHub Actions / build-and-test (windows-latest)

Evaluation of this argument may be expensive and unnecessary if logging is disabled (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1873)

Check failure on line 54 in test/TestBuildingBlocks/XUnitLogHttpMessageHandler.cs

View workflow job for this annotation

GitHub Actions / build-and-test (windows-latest)

Evaluation of this argument may be expensive and unnecessary if logging is disabled (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1873)

Check failure on line 54 in test/TestBuildingBlocks/XUnitLogHttpMessageHandler.cs

View workflow job for this annotation

GitHub Actions / build-and-test (macos-latest)

Evaluation of this argument may be expensive and unnecessary if logging is disabled (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1873)

Check failure on line 54 in test/TestBuildingBlocks/XUnitLogHttpMessageHandler.cs

View workflow job for this annotation

GitHub Actions / build-and-test (macos-latest)

Evaluation of this argument may be expensive and unnecessary if logging is disabled (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1873)

Check failure on line 54 in test/TestBuildingBlocks/XUnitLogHttpMessageHandler.cs

View workflow job for this annotation

GitHub Actions / build-and-test (ubuntu-latest)

Evaluation of this argument may be expensive and unnecessary if logging is disabled (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1873)

Check failure on line 54 in test/TestBuildingBlocks/XUnitLogHttpMessageHandler.cs

View workflow job for this annotation

GitHub Actions / build-and-test (ubuntu-latest)

Evaluation of this argument may be expensive and unnecessary if logging is disabled (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1873)
}
else
{
LogResponseMessage(response.ToString(), string.Empty, string.Empty);

Check failure on line 58 in test/TestBuildingBlocks/XUnitLogHttpMessageHandler.cs

View workflow job for this annotation

GitHub Actions / build-and-test (windows-latest)

Evaluation of this argument may be expensive and unnecessary if logging is disabled (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1873)

Check failure on line 58 in test/TestBuildingBlocks/XUnitLogHttpMessageHandler.cs

View workflow job for this annotation

GitHub Actions / build-and-test (windows-latest)

Evaluation of this argument may be expensive and unnecessary if logging is disabled (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1873)

Check failure on line 58 in test/TestBuildingBlocks/XUnitLogHttpMessageHandler.cs

View workflow job for this annotation

GitHub Actions / build-and-test (macos-latest)

Evaluation of this argument may be expensive and unnecessary if logging is disabled (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1873)

Check failure on line 58 in test/TestBuildingBlocks/XUnitLogHttpMessageHandler.cs

View workflow job for this annotation

GitHub Actions / build-and-test (macos-latest)

Evaluation of this argument may be expensive and unnecessary if logging is disabled (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1873)

Check failure on line 58 in test/TestBuildingBlocks/XUnitLogHttpMessageHandler.cs

View workflow job for this annotation

GitHub Actions / build-and-test (ubuntu-latest)

Evaluation of this argument may be expensive and unnecessary if logging is disabled (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1873)

Check failure on line 58 in test/TestBuildingBlocks/XUnitLogHttpMessageHandler.cs

View workflow job for this annotation

GitHub Actions / build-and-test (ubuntu-latest)

Evaluation of this argument may be expensive and unnecessary if logging is disabled (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1873)
}
}

Expand Down
Loading