viodotcom / meta_logger

A wrapper for Elixir Logger that keeps and returns the logger metadata from the caller processes.
Apache License 2.0
20 stars 2 forks source link

Format query string in request logs #13

Closed prodis closed 2 years ago

prodis commented 3 years ago

In the Tesla.Middleware.MetaLogger the query string params in the request are logged as keywords.

For example:

[debug] [BoFH.Providers.GAR.Client.API.Availability] GET https://availability.getaroom.com/api/1.1/properties/c794e347-a4e0-44ef-8d50-ba68bff05567/room_availability [api_key: "[FILTERED]", auth_token: "[FILTERED]", booking_currency: "EUR", cancellation_rules: 1, check_in: "01/13/2022", check_out: "01/14/2022", hotel_id: "c794e347-a4e0-44ef-8d50-ba68bff05567", rinfo: "[[-1,-1,-1,-1,-1]]", transaction_id: "a487ad12-cbd6-4b53-9f09-d1881b0da4e0"] [{"accept", "application/xml"}, {"accept-encoding", "gzip"}, {"user-agent", "BoFH.Providers.GAR/2.85.1"}

It is more useful if the query string params are logged as query string along the URL.

For the same example above:

[debug] [BoFH.Providers.GAR.Client.API.Availability] GET https://availability.getaroom.com/api/1.1/properties/c794e347-a4e0-44ef-8d50-ba68bff05567/room_availability?api_key=[FILTERED]&auth_token=[FILTERED]&booking_currency=EUR&cancellation_rules=1&check_in=01/13/2022&check_out=01/14/2022&hotel_id=c794e347-a4e0-44ef-8d50-ba68bff05567&rinfo=[[-1,-1,-1,-1,-1]]&transaction_id=a487ad12-cbd6-4b53-9f09-d1881b0da4e0 [{"accept", "application/xml"}, {"accept-encoding", "gzip"}, {"user-agent", "BoFH.Providers.GAR/2.85.1"}
prodis commented 2 years ago

Solved with https://github.com/FindHotel/meta_logger/pull/15.