When using LogExtraAttrs to add additional attributes to the log, the reqBody is passed as a string parameter. In the case of large request bodies, for example, file uploads, this can lead to high memory usage.
Additionally, in situations where reqBody isn't accessed within LogExtraAttrs, there is unnecessary processing overhead introduced with TeeReader.
Possibly adding an alternate callback for adding attributes to the log that doesn't involve the request body, and/or a way to opt-in/out of having access to the reqBody?
Would solicit input on the preferred approach to implement, but happy to submit a PR if there is an appetite to address this.
When using
LogExtraAttrsto add additional attributes to the log, thereqBodyis passed as a string parameter. In the case of large request bodies, for example, file uploads, this can lead to high memory usage.Additionally, in situations where
reqBodyisn't accessed withinLogExtraAttrs, there is unnecessary processing overhead introduced with TeeReader.Possibly adding an alternate callback for adding attributes to the log that doesn't involve the request body, and/or a way to opt-in/out of having access to the
reqBody?Would solicit input on the preferred approach to implement, but happy to submit a PR if there is an appetite to address this.