Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@kevwan
Copy link
Contributor

@kevwan kevwan commented Aug 8, 2025

No description provided.

@kevwan kevwan added this to the v1.9.0 milestone Aug 8, 2025
@kevwan kevwan linked an issue Aug 8, 2025 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Aug 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@kevwan kevwan requested a review from Copilot August 8, 2025 12:15
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR optimizes logging with fields by deferring field value processing until the actual log output, preventing unnecessary computation when logs are filtered out by level. The change moves field value type conversion and formatting from the Field() function to the output() function.

  • Moved field value processing from Field() creation to output() execution
  • Added comprehensive test coverage for log level filtering with field processing
  • Introduced deferred evaluation to avoid processing fields when logs won't be written

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
core/logx/writer.go Added processFieldValue function and integrated it into output() for deferred field processing
core/logx/logs.go Simplified Field() function to store raw values without immediate processing
core/logx/logs_test.go Added tests to verify field processing is skipped when log level filtering occurs

@kevwan kevwan requested a review from zhoushuguang August 8, 2025 12:16
@kevwan kevwan added this pull request to the merge queue Aug 8, 2025
Merged via the queue into zeromicro:master with commit 3152581 Aug 8, 2025
6 checks passed
@kevwan kevwan deleted the opt/fix-5059 branch August 8, 2025 12:23
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.

Logging implementation is terrible

2 participants