Closed johnMorone closed 7 months ago
Hey, thanks for raising this issue! The best way to do this will be to pass in a custom fetch into the Finch client. See https://github.com/Finch-API/finch-api-node#customizing-the-fetch-client. We'll improve the docs story here around logging.
Thank you @yjp20 ! This works fantastically! If I was more careful with the documentation, I think I could have found this - sorry for not seeing it. I do think a few small doc updates could streamline the dev experience nicely here: linking from the auto pagination pattern section as well as calling out in the Customizing the fetch client section that this is a recommended way to have consistent logging as mentioned in the Production Readiness Checklist.
Thank you again - I'll close this out as I'm good to go here!
Hello, I'm trying to reconcile the suggested auto pagination pattern in the docs with the recommendation from the Production Readiness Checklist to log request id's for all transactions, not just errors.
Logging errors with this pattern works fine as long as it is wrapped in a
try ... catch
block, where the catch can log the error. However, it appears there is no way to log non-erroring requests with this pattern, as it can't be used along with thewithResponse
method.Am I understanding this correctly? Is it OK to not log these instances if so? Or is there some undocumented method to log using this pattern either currently available or upcoming?
Thank you!