nberger / ring-logger

Log ring requests & responses using your favorite logging backend
Eclipse Public License 1.0
101 stars 21 forks source link

Filter query string #27

Closed kendagriff closed 6 years ago

kendagriff commented 6 years ago

I have a query string like this: /login?access_token=xxx123. ring-logger exposes redact-keys to filter access_token from the request params, but it's not filtered from the query-string. Any suggestions for filtering it? I'd be happy to submit a pull request.

kendagriff commented 6 years ago

No quick suggestions here?

nberger commented 6 years ago

There is currently no way to disable the query-string logging.

The quick suggestion is to implement your custom messages that would skip query-string as shown in https://github.com/nberger/ring-logger#custom-messages-and-how-to-disable-coloring.

I see how this can be a concern for many users, so I'd accept a PR adding an option log-query-string? that would avoid logging the query-string in the default messages methods. Default should be true to be backwards compatible.

kendagriff commented 6 years ago

K, thank you. I'll take a stab at something this coming week...

kendagriff commented 6 years ago

In the end, I went with your suggestion above to provide a custom multimethod. We needed to hide the query string conditionally. Thank you!