Skip to content
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

feat(logging): separate fields #91

Merged

Conversation

neil-sciberras
Copy link
Contributor

No description provided.

@neil-sciberras neil-sciberras requested a review from a team as a code owner October 10, 2024 21:51
return response;
}

var responseContent = await response.Content.ReadAsStringAsync();
_logger.LoggerHttp_ResponseDetailed(response, response.Headers.ToFormattedString(), responseContent, stopwatchElapsed.TotalMilliseconds);
_logger.LoggerHttp_ResponseDetailed(request.Method, request.Uri!, path, response.StatusCode, response.Headers.ToFormattedString(), responseContent, stopwatchElapsed.TotalMilliseconds, httpVersion);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

httpVersion theres one in the request and one in the response - for this one we can log the response one

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


[LoggerMessage(LogLevel.Information, "Post-request... {response}\nHeaders: {headers}\nContent: {responseContent} in {elapsed:n0}ms")]
internal static partial void LoggerHttp_ResponseDetailed(this ILogger logger, FluentHttpResponse response, string headers, string? responseContent, double elapsed);
[LoggerMessage(LogLevel.Information, "HTTP request [{method}] '{requestUrl}' ({path}) responded {statusCode:D} in {elapsed:n0}ms ({httpVersion})")]
Copy link
Member

@stephenlautier stephenlautier Oct 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Would move the version infront, and part of the request
Suggested change
[LoggerMessage(LogLevel.Information, "HTTP request [{method}] '{requestUrl}' ({path}) responded {statusCode:D} in {elapsed:n0}ms ({httpVersion})")]
[LoggerMessage(LogLevel.Information, "HTTP request ({httpVersion}) [{method}] '{requestUrl}' ({path}) responded {statusCode:D} in {elapsed:n0}ms")]
  • path I think I would remove

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@stephenlautier stephenlautier merged commit cba6a90 into sketch7:master Oct 11, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants