Skip to content

docs(logger): clarify ${bytesSent} behavior in logger middleware#4251

Merged
ReneWerner87 merged 2 commits into
gofiber:mainfrom
elton-peixoto-lu:docs/logger-bytessent-4226
May 4, 2026
Merged

docs(logger): clarify ${bytesSent} behavior in logger middleware#4251
ReneWerner87 merged 2 commits into
gofiber:mainfrom
elton-peixoto-lu:docs/logger-bytessent-4226

Conversation

@elton-peixoto-lu
Copy link
Copy Markdown
Contributor

Summary

Clarifies the behavior of the ${bytesSent} logger tag in the middleware documentation.

Changes

  • document that ${bytesSent} is based on the Content-Length response header
  • mention that it may be 0 when Content-Length is not set
  • mention that it may be -1 for streaming responses
  • clarify that Fiber does not calculate the actual response body size for performance reasons

Notes

  • documentation-only change
  • no runtime behavior changed

Validation

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 4, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: dcc01f1b-4da1-4a75-8a1f-19918975a7ff

📥 Commits

Reviewing files that changed from the base of the PR and between dfec5f6 and 225074e.

📒 Files selected for processing (1)
  • docs/middleware/logger.md
✅ Files skipped from review due to trivial changes (1)
  • docs/middleware/logger.md

Walkthrough

This PR adds a documentation tip to the logger middleware explaining that ${bytesSent} is taken from the response Content-Length header; if the header is missing or the response is streaming/chunked, ${bytesSent} is -1, and Fiber does not compute the actual body size for performance.

Changes

Logger Middleware Documentation

Layer / File(s) Summary
Documentation Insertion
docs/middleware/logger.md
Inserted a tip (lines 209–212) clarifying ${bytesSent} is sourced from the response Content-Length header and is -1 when the header is missing or the response is streaming/chunked; notes Fiber does not compute body size for performance.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

Suggested reviewers

  • gaby
  • ReneWerner87

Poem

Hop, hop, a doc update bright and spry 🐇
Bytes sent now follow the header's sky,
When streaming flows or headers hide,
-1 is written with performance pride ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the purpose, changes made, and notes that this is documentation-only with no runtime changes. However, it does not follow the repository's required description template structure. Reformat the description to follow the repository's template, including sections like 'Type of change', 'Changes introduced', and the 'Checklist' items to ensure consistency with project standards.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: clarifying the ${bytesSent} behavior in logger middleware documentation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 6/8 reviews remaining, refill in 12 minutes and 53 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds documentation for the ${bytesSent} variable in the logger middleware. The review feedback suggests refining the technical accuracy of the explanation regarding missing headers and using a callout block to align with the project's documentation style.

Comment thread docs/middleware/logger.md Outdated
@elton-peixoto-lu elton-peixoto-lu marked this pull request as ready for review May 4, 2026 11:24
@elton-peixoto-lu elton-peixoto-lu requested a review from a team as a code owner May 4, 2026 11:24
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@ReneWerner87 ReneWerner87 linked an issue May 4, 2026 that may be closed by this pull request
3 tasks
@ReneWerner87 ReneWerner87 merged commit 23ffde8 into gofiber:main May 4, 2026
6 checks passed
@welcome
Copy link
Copy Markdown

welcome Bot commented May 4, 2026

Congrats on merging your first pull request! 🎉 We here at Fiber are proud of you! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord

@github-project-automation github-project-automation Bot moved this to Done in v3 May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

🐛 [Bug]: bytesSent tag not working in logging middleware.

2 participants