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

Logging of query params #1024

Open
bobrippling opened this issue Mar 12, 2023 · 0 comments
Open

Logging of query params #1024

bobrippling opened this issue Mar 12, 2023 · 0 comments
Labels
feature New feature or request

Comments

@bobrippling
Copy link

Is your feature request related to a problem? Please describe.
I'd like to be able to log out the query parameters of a request, to aid in development of a webserver where I'd like to see what query parameters a blackbox client is sending up.

Describe the solution you'd like
A way to have the query parameters in log output, like so:

INFO myhttp > 127.0.0.1:61128 "GET /api/bob.json HTTP/1.1" 200 "-" "curl/7.85.0" 7.290966ms

# becoming

INFO myhttp > 127.0.0.1:61128 "GET /api/bob.json?frobnicate&percumbulator=7 HTTP/1.1" 200 "-" "curl/7.85.0" 7.290966ms
                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^

Describe alternatives ideas you've considered
I'd like to expose Route::query on log's Info struct, perhaps as two methods:

  • pub fn query_params(&self) -> &str returns ?x=1&y=2
    (possibly returning String if the &str isn't available)
  • pub fn path_with_query(&self) -> &str returns /api/whatever?x=1&y=2
    (same)
  • We could optionally add warp::log::with_query to do this automatically, alongside warp::log.

If these ideas aren't too controversial, I'm happy to make a PR for them.

@bobrippling bobrippling added the feature New feature or request label Mar 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant