charlatan icon indicating copy to clipboard operation
charlatan copied to clipboard

Support additional debugging verbosity

Open btrautmann opened this issue 2 years ago • 0 comments

TLDR: We should support a way (possibly via a hook on the Charlatan object) to output additional logs on things like attempted matches and failed matches such that the end user doesn't need to add break-points to debug Charlatan or pull it locally. The default verbosity would remain, so this would be opt-in per Charlatan instance.

Sam's comment:

I feel ya on the struggle of making this readable for gql or other nuanced requests.

Two thoughts:

  1. We could probably do something to include the query string here in addition to just the path. That won't help for gql unless we make some tweaks to clients to include the operation name in the query string. Which would be really useful
  2. We could add a hook on Charlatan to allow you to customize how the request prints out for this debugging use case with a solid default. Then consumers can do whatever makes sense to them to make the failed match on the request easier to interpret. Like in the case of gql maybe you can parse the operation name from the body instead of using the whole body. Not sure of a great name for this. Maybe requestDebugFormatter? Naming this is hard haha

What do you think?

Originally posted by @samandmoore in https://github.com/Betterment/charlatan/pull/26#discussion_r1165486040

btrautmann avatar Apr 13 '23 14:04 btrautmann