Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔥 feat: Add Filter option to logger middleware #3333

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

JIeJaitt
Copy link
Contributor

@JIeJaitt JIeJaitt commented Feb 27, 2025

Description

The Filter is a function that is called before the log string for a request is written to Output. If it returns true, the log will be written; otherwise, it will be skipped.

Fixes #3300

Copy link
Contributor

coderabbitai bot commented Feb 27, 2025

Walkthrough

The pull request introduces a new logging filter feature to the Fiber middleware. A Filter function property is added to the logging configuration, allowing users to conditionally log requests based on custom logic. The default configuration is updated to initialize the Filter to nil, and the logger’s control flow is modified to skip logging when the Filter returns false. Additionally, new tests verify the functionality using different HTTP response statuses.

Changes

File(s) Change Summary
docs/middleware/logger.md
middleware/logger/config.go
Added a new Filter property (function type) to the logging configuration and updated the default configuration to set Filter to nil.
middleware/logger/default_logger.go Modified the default logger to check the Filter function, skipping logging if the function returns false.
middleware/logger/logger_test.go Added Test_Logger_Filter with subtests to validate that logging is conditionally performed based on HTTP response status codes.
docs/whats_new.md Introduced a new section describing the Filter function with examples demonstrating its usage in the logging middleware.

Suggested reviewers

  • sixcolors
  • gaby
  • ReneWerner87
  • efectn

Poem

In a code garden where logs unfold,
I hop with joy as new functions are told.
With a filter in paw, I skip the undesired,
Letting only the worthy be duly admired.
A rabbit's trail in code is truly inspired!
🐰✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e2295e5 and 0ac13c8.

📒 Files selected for processing (2)
  • docs/whats_new.md (1 hunks)
  • middleware/logger/logger_test.go (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: unit (1.24.x, macos-13)
  • GitHub Check: unit (1.24.x, macos-latest)
  • GitHub Check: unit (1.24.x, windows-latest)
  • GitHub Check: unit (1.23.x, macos-13)
  • GitHub Check: unit (1.23.x, macos-latest)
  • GitHub Check: unit (1.23.x, windows-latest)
  • GitHub Check: Compare
  • GitHub Check: repeated
🔇 Additional comments (5)
docs/whats_new.md (2)

915-944: Well-implemented feature documentation with clear examples.

The documentation for the Filter function is clear and provides excellent examples showing different use cases for filtering logs based on HTTP status codes. Each example demonstrates a practical scenario: filtering errors (status ≥ 400), filtering specific status codes (404), and excluding successful responses (not 200).


930-932:

❓ Verification inconclusive

Verify the filter logic is consistent with the comment.

The example shows a filter for 404 status codes, but consider if this actually matches the comment's intent. If return c.Response().StatusCode() == fiber.StatusNotFound is true, the log will be written, meaning 404 responses will be logged (not skipped).


🏁 Script executed:

#!/bin/bash
# Check if the logger's implementation in the codebase validates the filter behavior
cat middleware/logger/default_logger.go | grep -A 10 "Filter"

Length of output: 407


Clarify 404 Logging Behavior
After verifying the logger logic in middleware/logger/default_logger.go, it's clear that the filter function’s return value is used as a predicate for logging. In particular, if the filter (e.g., return c.Response().StatusCode() == fiber.StatusNotFound) returns true—which it does for 404 responses—the condition !cfg.Filter(c) evaluates to false, and logging is carried out. This means that 404 responses are actually logged rather than skipped.

Please confirm whether logging 404 responses is the intended behavior. If the goal was to exclude 404 responses from being logged, the filter should return false when encountering those responses, or the documentation should be updated to clarify this behavior.

middleware/logger/logger_test.go (3)

174-228: Well-structured test implementation for Filter functionality.

The test implementation for the Filter feature is excellent. You've created focused tests that verify both inclusion and exclusion filtering scenarios:

  1. The first test confirms that when filtering for 404 status codes, logs contain "404" for not-found routes
  2. The second test confirms that when filtering out 200 status codes, logs don't contain "200" for successful requests

Using a single middleware instance that combines both the filter condition and output capture ensures the tests accurately validate the filtering functionality.


210-213: Consistent filter logic in second test case.

The filter implementation in this test case correctly implements the logic to exclude 200 status codes, which aligns perfectly with the comment "log status code != 200". This ensures that response status codes other than 200 will be logged, providing a useful way to monitor non-success responses.


187-190:

✅ Verification successful

Ensure comment aligns properly with filter logic.

The filter logic implemented here (returning true for status code 404) will include 404 responses in logs. The comment "log status code == 404" is correct, but it's important to ensure this matches the intent in the documentation which states that the Filter function returns true to write the log and false to skip it.


🏁 Script executed:

#!/bin/bash
# Verify how the filter is used in the implementation
grep -r "Filter" --include="*.go" middleware/logger/

Length of output: 948


Clarified Logging Behavior for 404 Responses

The filter function correctly returns true when the response status code is 404, meaning that these responses will be logged (since the logger writes the log when the filter returns true). The inline comment (“log status code == 404”) accurately reflects this behavior. Please ensure that any related documentation remains consistent with the filter’s contract: a return value of true logs the response, while false skips it.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Feb 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.21%. Comparing base (8e54c8f) to head (bb05227).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3333   +/-   ##
=======================================
  Coverage   84.21%   84.21%           
=======================================
  Files         116      116           
  Lines       11578    11584    +6     
=======================================
+ Hits         9750     9756    +6     
  Misses       1397     1397           
  Partials      431      431           
Flag Coverage Δ
unittests 84.21% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@JIeJaitt
Copy link
Contributor Author

JIeJaitt commented Feb 27, 2025

@ReneWerner87 hi, there
Strange, this unit test runs locally for me without any problem, but reports an error in GitHub Action

@ReneWerner87
Copy link
Member

@ReneWerner87 hi, there Strange, this unit test runs locally for me without any problem, but reports an error in GitHub Action

did you also run this local with the “-race” flag ?

@gaby
Copy link
Member

gaby commented Feb 27, 2025

@ReneWerner87 hi, there Strange, this unit test runs locally for me without any problem, but reports an error in GitHub Action

did you also run this local with the “-race” flag ?

I just ran them locally with make test and it doesn't fail.

@gaby
Copy link
Member

gaby commented Feb 27, 2025

@ReneWerner87 hi, there Strange, this unit test runs locally for me without any problem, but reports an error in GitHub Action

did you also run this local with the “-race” flag ?

I just ran them locally with make test and it doesn't fail.

Using make longtest does trigger the same race condition we are seeing in the CI

@gaby
Copy link
Member

gaby commented Feb 27, 2025

@ReneWerner87 hi, there Strange, this unit test runs locally for me without any problem, but reports an error in GitHub Action

did you also run this local with the “-race” flag ?

I just ran them locally with make test and it doesn't fail.

Using make longtest does trigger the same race condition we are seeing in the CI

Pretty sure this is related to re-using the same app across all the new tests introduced in this PR. They are both running in parallel and registering /.

@gaby
Copy link
Member

gaby commented Feb 27, 2025

ok, unit-tests are passing now.

@gaby gaby marked this pull request as ready for review February 27, 2025 13:24
@gaby gaby requested a review from a team as a code owner February 27, 2025 13:24
@gaby gaby requested review from gaby, sixcolors, ReneWerner87 and efectn and removed request for a team February 27, 2025 13:24
@gaby gaby added this to the v3 milestone Feb 27, 2025
@gaby gaby changed the title 🔥 Feature(logger): Add Filter option to logger middleware 🔥 feat: Add Filter option to logger middleware Feb 27, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
docs/middleware/logger.md (1)

161-161: Fix missing colon in the default configuration.

There's a syntax issue in the ConfigDefault example - the colon is missing after Filter.

-    Filter         nil,
+    Filter:        nil,
middleware/logger/logger_test.go (1)

183-187: Consider adding more diverse test cases for the Filter functionality.

The current tests only verify filtering based on status codes. Consider adding tests for other scenarios, such as filtering based on request path, method, or headers.

middleware/logger/config.go (1)

23-27: Documentation for the Filter property is clear, but has a minor inaccuracy.

The comment describes the filter function as returning true to write the log, but looking at the implementation in default_logger.go, the condition is !cfg.Filter(c) meaning it skips logging if the filter returns false.

To make this clearer and consistent with the implementation:

-	// Filter is a function that is called before writing the log string.
-	// If it returns true, the log will be written; otherwise, it will be skipped.
+	// Filter is a function that is called before writing the log string.
+	// If it returns false, the log will be skipped; otherwise, it will be written.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 86cf806 and 572233e.

📒 Files selected for processing (4)
  • docs/middleware/logger.md (2 hunks)
  • middleware/logger/config.go (3 hunks)
  • middleware/logger/default_logger.go (1 hunks)
  • middleware/logger/logger_test.go (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: repeated
  • GitHub Check: Compare
🔇 Additional comments (4)
middleware/logger/default_logger.go (1)

93-96: Conditional logging filter implementation looks good.

The filtering logic is correctly implemented with proper nil check and logical flow. This allows for selective logging based on custom criteria, which is a useful feature to reduce noise in logs.

docs/middleware/logger.md (1)

142-142: Documentation for the new Filter property is clear and well-formatted.

The new Filter property is properly documented with a clear description of its purpose and behavior.

middleware/logger/config.go (2)

107-107: ConfigDefault correctly includes the new Filter field.

The default setting of nil is appropriate for this optional functionality.


136-138: Proper initialization of Filter in configDefault function.

The Filter property is correctly initialized with the default value if not provided.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@gaby
Copy link
Member

gaby commented Mar 2, 2025

@JIeJaitt Add a section in docs/whats_new.md should be ready to merge after that.

@JIeJaitt
Copy link
Contributor Author

JIeJaitt commented Mar 2, 2025

@gaby I thought about it and you are right. The filter() function can focus on the decision-making logic without having to care about the specific processing details of the log string.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2154baf and 6528b9f.

📒 Files selected for processing (1)
  • docs/whats_new.md (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: unit (1.24.x, macos-13)
  • GitHub Check: unit (1.24.x, macos-latest)
  • GitHub Check: unit (1.24.x, windows-latest)
  • GitHub Check: unit (1.23.x, macos-13)
  • GitHub Check: unit (1.23.x, windows-latest)
  • GitHub Check: Analyse
  • GitHub Check: Compare
  • GitHub Check: repeated

@gaby
Copy link
Member

gaby commented Mar 3, 2025

@coderabbitai full review

Copy link
Contributor

coderabbitai bot commented Mar 3, 2025

✅ Actions performed

Full review triggered.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (1)
docs/whats_new.md (1)

943-961: ⚠️ Potential issue

Critical issue: Inconsistent filter example logic.

The documentation states that when the Filter function returns true the log will be written, and when it returns false the log will be skipped. In the provided examples, the second example (logging only for status 200) is consistent with this behavior. However, in the first example the comment indicates that logging should be skipped for 404 requests, but the code returns:

return c.Response().StatusCode() == fiber.StatusNotFound

This condition returns true when the status code is 404, meaning a 404 response would be logged rather than skipped. To align the logic with the intended behavior (i.e., skip logging for 404 responses), consider inverting the condition. For example:

-        return c.Response().StatusCode() == fiber.StatusNotFound
+        return c.Response().StatusCode() != fiber.StatusNotFound

This change would ensure that the log is written only when the status code is not 404, thereby skipping 404 responses as the comment suggests.

🧹 Nitpick comments (1)
docs/middleware/logger.md (1)

142-142: New Filter Property Documentation Addition
The configuration table now includes the Filter property with the function signature func(fiber.Ctx) bool and a clear description. This documentation clearly explains that the function is invoked before writing the log output and will skip logging if it returns false. Consider adding a brief usage example in the "Examples" section to illustrate how to leverage this filter in a real scenario.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9e6f4fd and 75976af.

📒 Files selected for processing (5)
  • docs/middleware/logger.md (2 hunks)
  • docs/whats_new.md (1 hunks)
  • middleware/logger/config.go (3 hunks)
  • middleware/logger/default_logger.go (1 hunks)
  • middleware/logger/logger_test.go (1 hunks)
🔇 Additional comments (7)
middleware/logger/default_logger.go (1)

18-21: Filter implementation looks correct.

This implementation adds a filter capability to the logger, allowing conditional logging based on request context. The placement at the beginning of the function is efficient as it avoids unnecessary processing for requests that should be skipped.

middleware/logger/logger_test.go (1)

174-224: Test structure looks good and effectively validates the filter functionality.

The test implementation properly verifies the filter functionality with two distinct test cases:

  1. Verifying that logs are written for 404 status codes when filtered to only log those
  2. Verifying that logs are not written for 200 status codes with the same filter

The tests correctly use a single middleware instance with both the filter and output capture, which accurately tests the filter's behavior.

middleware/logger/config.go (4)

23-27: Well-defined and properly documented feature addition.

The new Filter function field is well-designed and appropriately documented. It provides a clean extension point for conditionally logging requests based on custom logic, which addresses issue #3300 as mentioned in the PR objectives.


107-107: Appropriate default value for the new Filter field.

Setting the default value to nil is appropriate as it:

  1. Maintains backward compatibility
  2. Makes the feature optional
  3. Follows the pattern of other optional function fields in the Config struct

136-138: Proper implementation of default value handling.

The implementation correctly follows the established pattern for handling default values in the configDefault function. This ensures consistent behavior when users don't explicitly provide a filter function.


23-27:

✅ Verification successful

Verify usage examples are provided in documentation.

The implementation looks good, but users might benefit from usage examples in the documentation showing how to implement filter functions for common scenarios (e.g., filtering by status code, path, etc.).


🏁 Script executed:

#!/bin/bash
# Check if examples are provided in the logger middleware documentation

# Look for Filter examples in docs
echo "Checking for Filter usage examples in documentation..."
grep -A 10 "Filter" docs/middleware/logger.md || echo "No Filter examples found in logger documentation"

# Check if the new feature is mentioned in what's new document
echo "Checking for mention in what's new document..."
grep -A 5 "Filter" docs/whats_new.md || echo "No mention of Filter in what's new document"

Length of output: 3951


Documentation Examples Verified

The Filter usage examples are clearly present in both docs/middleware/logger.md and docs/whats_new.md, demonstrating common scenarios like filtering based on status codes. No further action is required.

docs/middleware/logger.md (1)

161-161: Default Config Update: 'Filter' Initialization
The default configuration now initializes the Filter property to nil, which preserves the existing logging behavior when no filter is provided. This is consistent with the documented default in the configuration table.

Copy link
Member

@gaby gaby left a comment

Choose a reason for hiding this comment

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

One last thing

app.Use(logger.New(logger.Config{
Filter: func(c fiber.Ctx) bool {
// Skip logging for 404 requests
return c.Response().StatusCode() == fiber.StatusNotFound
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be != ?

If its 404 it returns True, which the defaultLogger negates into False and doesn't filter

@@ -171,6 +171,58 @@ func Test_Logger_Done(t *testing.T) {
require.Positive(t, buf.Len(), 0)
}

func Test_Logger_Filter(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

I'm confused about how this is working.

If the condition is True, it will become False in defaultLogger. But we dont check for that in the test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gaby Thanks for the heads up. I've just checked and found a few things that need to be refined, it's almost midnight here, I'll submit a more complete unit test and documentation note tomorrow.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good. Thanks!

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
docs/whats_new.md (1)

921-925: Fix inconsistency between comment and code.

The comment states "log status code >= 400" but the code actually checks for status codes >= 404 (StatusNotFound). For accurate documentation, you should either update the comment or modify the condition.

- // log status code >= 400
+ // log status code >= 404
  return c.Response().StatusCode() >= fiber.StatusNotFound

Alternatively, to match the comment:

  // log status code >= 400
- return c.Response().StatusCode() >= fiber.StatusNotFound
+ return c.Response().StatusCode() >= fiber.StatusBadRequest
middleware/logger/logger_test.go (1)

174-176: Test function documentation could be improved.

Consider adding a documentation comment to explain the purpose of this test function.

+// Test_Logger_Filter tests the Filter functionality of the logger middleware.
+// It verifies that logs are written or skipped based on the filter condition.
 func Test_Logger_Filter(t *testing.T) {
 	t.Parallel()
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 288edb2 and e2295e5.

📒 Files selected for processing (3)
  • docs/middleware/logger.md (2 hunks)
  • docs/whats_new.md (1 hunks)
  • middleware/logger/logger_test.go (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: unit (1.24.x, macos-13)
  • GitHub Check: unit (1.24.x, windows-latest)
  • GitHub Check: unit (1.23.x, windows-latest)
  • GitHub Check: Compare
  • GitHub Check: repeated
🔇 Additional comments (7)
docs/whats_new.md (3)

915-916: Filter function documentation looks good.

The description clearly explains the purpose of the Filter function: it acts as a condition to determine whether a request should be logged.


935-940: Ensure this filter works as expected.

The comment and implementation align correctly. When the filter returns true (status != 200), the log will be written, which means logs will be skipped for 200 status codes.


928-932:

❓ Verification inconclusive

Inconsistent filtering logic.

This example has a potential issue with the filter logic. The comment says "log status code == 404", but the filter is returning true when the status is 404. The documentation at line 915-916 states that when the filter returns true, the log will be written. However, there seems to be confusion in past review comments about how this interacts with the defaultLogger.

Let's verify the implementation to ensure this works as expected:


🏁 Script executed:

#!/bin/bash
# Check how the Filter is used in the logger middleware implementation

# Search for places where the Filter is checked
rg -A 3 "if c\.Filter" middleware/logger/

Length of output: 43


Action Required: Verify Logger Filter Usage Consistency

The documentation snippet in docs/whats_new.md (lines 928–932) shows a logger configuration with a Filter function that returns true when the response status is equal to fiber.StatusNotFound. According to the docs (lines 915–916), returning true should trigger logging. However, our initial search for usage of c.Filter in the logger middleware (using rg -A 3 "if c\.Filter" middleware/logger/) did not produce any output.

Please manually verify the logger middleware implementation—especially within the logger.New configuration in the middleware/logger/ directory—to ensure that the Filter logic is applied as expected and interacts correctly with the default logger behavior.

middleware/logger/logger_test.go (2)

177-198: Test implementation for 404 filters looks good.

The test correctly sets up a logger middleware with a filter that only logs 404 responses, and then verifies that the output contains "404". This confirms the filter behavior works as expected.


200-225: Test implementation for 200 filter looks good.

The test correctly sets up a filter that logs everything except 200 responses, and verifies that the output does not contain "200". This confirms that the filter successfully skips logging OK responses.

docs/middleware/logger.md (2)

142-142: Filter property documentation looks good.

The description clearly explains what the Filter function does and how it affects logging behavior.


161-161: ⚠️ Potential issue

Fix syntax error in ConfigDefault.

There's a missing comma after nil in the ConfigDefault declaration, which would cause a compilation error.

- Filter         nil,
+ Filter:         nil,

Likely an incorrect or invalid review comment.

@JIeJaitt JIeJaitt requested a review from gaby March 4, 2025 05:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Feature Request: Add a Pre-Write Callback to Logger Middleware
3 participants