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

Improve ktor-client request/response logging #1728

Closed

Conversation

dragneelfps
Copy link
Contributor

Related to #1727

@eMZet-zz
Copy link

@dragneelfps
The changes seem fine.
val logContentType: LogContentType is a nice addition :)

@eMZet-zz
Copy link

Just wondering if
io.ktor.client.HttpClientConfig 's

/**
* Terminate [HttpClient.responsePipeline] if status code is not success(>=300).
*/
var expectSuccess: Boolean = true

will affect logging error responses if not changed to false.

@@ -24,12 +24,13 @@ import kotlinx.coroutines.*
class Logging(
val logger: Logger,
var level: LogLevel,
var filters: List<(HttpRequestBuilder) -> Boolean>
val filters: List<(HttpClientCall) -> Boolean>,
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if it's ok to replace the request builder with the call here. The call will be created only after the network request, but we should print the request log before any network activity.
Could you tell me if you have an idea of fixing this?

@stale
Copy link

stale bot commented May 16, 2020

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label May 16, 2020
@stale stale bot closed this May 30, 2020
@e5l e5l reopened this Apr 5, 2021
@e5l e5l removed the stale label Apr 5, 2021
@e5l e5l force-pushed the main branch 2 times, most recently from d084312 to 1ae2c1f Compare April 6, 2022 06:43
@rsinukov
Copy link
Contributor

rsinukov commented Jan 5, 2023

Closing this PR as stale

@rsinukov rsinukov closed this Jan 5, 2023
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.

4 participants