Skip to content

Feature Request: Simplify logging and debugging facilities for requests #3

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

Open
gildor opened this issue Apr 3, 2025 · 2 comments
Open

Comments

@gildor
Copy link

gildor commented Apr 3, 2025

Often, when I work on an HTTP request, I would like to see my final request and full response for debug purposes. It is not necessary to output it as part of notebook output (though it could also be useful in some situations).

Currently, it's not apparent how to do this. Maybe a special Notebook-level log window could be created and integrated with the Ktor logging plugin.
For now the only way is to print output of request manually, because NotebookHttpResponse.toString() has only basic information

@ark-1
Copy link
Contributor

ark-1 commented Apr 7, 2025

If you want to log these requests/responses to a cell output, you can indeed use Ktor logging plugin. You just need to set logger = Logger.SIMPLE in the configuration block.

val newHttp = http.config {
    Logging {
        level = LogLevel.BODY
        logger = Logger.SIMPLE
    }
}
Image

@gildor
Copy link
Author

gildor commented Apr 8, 2025

Ah, Logger.SIMPLE makes it work, thanks!
Maybe it's also possible to print body as JSON (or csv or other format supported by notebooks) automatically if Content-Type is application-json

It looks that it would still make sense to have an option to have a log window in addition to Notebooks output. But probably It's worth to report separately

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

No branches or pull requests

2 participants