-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Missing overrides in LoggingHttpMessageHandler and LoggingScopeHttpMessageHandler #85143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
7532cc5
add missing overrides in LoggingHttpMessageHandler and LoggingScopeHt…
mphelt 04c3ae6
Update LoggingUriOutputTests.cs
mphelt 0b6199c
Update LoggingHttpMessageHandler.cs
mphelt 022e908
Update LoggingScopeHttpMessageHandler.cs
mphelt a69446a
Update LoggingScopeHttpMessageHandler.cs
mphelt 44260f5
Update LoggingUriOutputTests.cs
mphelt 854dd1e
Add 'if NET5_0_OR_GREATER', fix typo in 'Loggs', add 'ConditionalFact'
mphelt ccb3a05
Update LoggingScopeHttpMessageHandler.cs
mphelt 6c14e66
Update LoggingUriOutputTests.cs
mphelt 8813153
Update LoggingUriOutputTests.cs
mphelt 86037ff
Update LoggingUriOutputTests.cs
mphelt 8ca29b4
Update LoggingUriOutputTests.cs
mphelt 838b640
Update LoggingHttpMessageHandler.cs
mphelt bb7daea
Update LoggingScopeHttpMessageHandler.cs
mphelt 14aa765
Extract helper methods
mphelt 16f55c9
Update LoggingHttpMessageHandler.cs
mphelt ebfe45b
Update LoggingScopeHttpMessageHandler.cs
mphelt 06de1f5
fix helper methods
mphelt ba43a5d
Update LoggingHttpMessageHandler.cs
mphelt 1d654a9
Update LoggingHttpMessageHandler.cs
mphelt 497d6c2
Update LoggingScopeHttpMessageHandler.cs
mphelt 080fbff
Merge pull request #4 from mphelt/mphelt-patch-1
mphelt 91d421b
Code style update
mphelt 67d2534
back to private methods
mphelt 08ecd2c
merge with dotnet/runtime (#7)
mphelt caefe8b
Merge branch 'dotnet:main' into main
mphelt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,6 +69,24 @@ async Task<HttpResponseMessage> Core(HttpRequestMessage request, CancellationTok | |
} | ||
} | ||
|
||
/// <inheritdoc /> | ||
/// <remarks>Loggs the request to and response from the sent <see cref="HttpRequestMessage"/>.</remarks> | ||
protected override HttpResponseMessage Send(HttpRequestMessage request, CancellationToken cancellationToken) | ||
{ | ||
ThrowHelper.ThrowIfNull(request); | ||
|
||
var shouldRedactHeaderValue = _options?.ShouldRedactHeaderValue ?? _shouldNotRedactHeaderValue; | ||
|
||
// Not using a scope here because we always expect this to be at the end of the pipeline, thus there's | ||
// not really anything to surround. | ||
Log.RequestStart(_logger, request, shouldRedactHeaderValue); | ||
var stopwatch = ValueStopwatch.StartNew(); | ||
var response = base.Send(request, cancellationToken); | ||
Log.RequestEnd(_logger, response, stopwatch.GetElapsedTime(), shouldRedactHeaderValue); | ||
|
||
return response; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we deduplicate this logic between E.g. by extracting it to a helper method private async Task<HttpResponseMessage> SendAsyncCore(HttpRequestMessage request, bool async, CancellationToken cancellationToken) |
||
} | ||
|
||
// Used in tests. | ||
internal static class Log | ||
{ | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.