Skip to content

Commit 0c576be

Browse files
author
Bart Koelman
committed
Add HTTP Method to trace logging
1 parent 76dbf36 commit 0c576be

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/JsonApiDotNetCore/Serialization/JsonApiReader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public async Task<InputFormatterResult> ReadAsync(InputFormatterContext context)
5050
string body = await GetRequestBodyAsync(context.HttpContext.Request.Body);
5151

5252
string url = context.HttpContext.Request.GetEncodedUrl();
53-
_traceWriter.LogMessage(() => $"Received request at '{url}' with body: <<{body}>>");
53+
_traceWriter.LogMessage(() => $"Received {context.HttpContext.Request.Method} request at '{url}' with body: <<{body}>>");
5454

5555
object model = null;
5656

test/JsonApiDotNetCoreExampleTests/IntegrationTests/Logging/LoggingTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public async Task Logs_request_body_at_Trace_level()
7777
loggerFactory.Logger.Messages.Should().NotBeEmpty();
7878

7979
loggerFactory.Logger.Messages.Should().ContainSingle(message => message.LogLevel == LogLevel.Trace &&
80-
message.Text.StartsWith("Received request at 'http://localhost/auditEntries' with body: <<", StringComparison.Ordinal));
80+
message.Text.StartsWith("Received POST request at 'http://localhost/auditEntries' with body: <<", StringComparison.Ordinal));
8181
}
8282

8383
[Fact]

0 commit comments

Comments
 (0)