Skip to content

feat: Allow configuring which req/res body content types to log#407

Merged
spencewenski merged 1 commit into
mainfrom
gh-390-req-res-content-type-logs
Oct 11, 2024
Merged

feat: Allow configuring which req/res body content types to log#407
spencewenski merged 1 commit into
mainfrom
gh-390-req-res-content-type-logs

Conversation

@spencewenski
Copy link
Copy Markdown
Member

Some req/res body content types are more useful to log than others. For example, it's not generally helpful to log image/x-icon or text/javascript. However, it can still be very useful for debugging to log things like application/json or
application/x-www-form-urlencoded.

Allow configuring which content types to allow to be logged. By default, all content types are allowed. Currently, only exact matches of content types are supported, so using text/* will not match text/plain, for example.

Closes #390

Some req/res body content types are more useful to log than others.
For example, it's not generally helpful to log `image/x-icon` or
`text/javascript`. However, it can still be very useful for debugging to
log things like `application/json` or
`application/x-www-form-urlencoded`.

Allow configuring which content types to allow to be logged. By default,
all content types are allowed. Currently, only exact matches of content
types are supported, so using `text/*` will not match `text/plain`, for
example.
@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 11, 2024

Codecov Report

Attention: Patch coverage is 29.34783% with 65 lines in your changes missing coverage. Please review.

Project coverage is 42.37%. Comparing base (f8d2a22) to head (774f79b).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...service/http/middleware/tracing/req_res_logging.rs 30.33% 62 Missing ⚠️
src/error/mime.rs 0.00% 3 Missing ⚠️
Files with missing lines Coverage Δ
src/error/axum.rs 0.00% <ø> (ø)
src/error/mod.rs 0.00% <ø> (ø)
src/error/mime.rs 0.00% <0.00%> (ø)
...service/http/middleware/tracing/req_res_logging.rs 34.81% <30.33%> (-0.19%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f8d2a22...774f79b. Read the comment docs.

@spencewenski spencewenski merged commit 53d7f02 into main Oct 11, 2024
@spencewenski spencewenski deleted the gh-390-req-res-content-type-logs branch October 11, 2024 22:28
@github-actions github-actions Bot mentioned this pull request Oct 11, 2024
spencewenski pushed a commit that referenced this pull request Oct 11, 2024
## 🤖 New release
* `roadster`: 0.6.7 -> 0.6.8 (✓ API compatible changes)

<details><summary><i><b>Changelog</b></i></summary><p>

<blockquote>

##
[0.6.8](roadster-v0.6.7...roadster-v0.6.8)
- 2024-10-11

### Added

- Allow configuring which req/res body content types to log
([#407](#407))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/MarcoIeni/release-plz/).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exclude certain content types from debug req/resp logs?

1 participant