Reduce verbose debug log contents#2134
Conversation
Signed-off-by: Seokho Son <shsongist@gmail.com>
There was a problem hiding this comment.
Pull Request Overview
This PR reduces verbose debug logging throughout the application to improve log readability and performance by commenting out detailed debug statements and adjusting log levels.
- Commented out detailed debug logs in spec filtering and processing operations
- Changed an info-level log to debug level in recommendation ordering
- Updated distance band thresholds in location-based ordering logic
- Fixed Go style issues and increased debug body length limit
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/core/resource/spec.go | Commented out verbose debug logs during spec filtering and processing, added TODO comment |
| src/core/infra/recommendation.go | Changed order-by log from info to debug level, updated distance band thresholds |
| src/core/common/utility.go | Removed unused variable in range loop |
| src/core/common/client/client.go | Increased debug body length limit and improved truncation message |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| Int("ignoredSpecs", ignoredCount). | ||
| Int("processedSpecs", int(specCount)). | ||
| Msgf("Spec processing completed: %d/%d specs processed (%d ignored)", | ||
| Msgf("Spec processing completed: %d/%d (%d ignored)", |
There was a problem hiding this comment.
[nitpick] The log message format is inconsistent with the previous pattern. Consider keeping the 'specs processed' terminology for clarity: Msgf(\"Spec processing completed: %d/%d specs processed (%d ignored)\",
| Msgf("Spec processing completed: %d/%d (%d ignored)", | |
| Msgf("Spec processing completed: %d/%d specs processed (%d ignored)", |
| // Fast integer approximation: ~7 bytes per word in JSON | ||
| bodyWords := bodyLength / 7 | ||
| limitWords := MaxDebugBodyLength / 7 | ||
|
|
||
| return fmt.Sprintf(`{"message":"Response body %d words (%d bytes) exceeds limit %d words (%d bytes). Use TRACE level to log and check content."}`, | ||
| bodyWords, bodyLength, limitWords, MaxDebugBodyLength) |
There was a problem hiding this comment.
[nitpick] The word count calculation using integer division by 7 is an approximation that may be confusing. Consider adding a comment explaining this is an estimate, or use a more descriptive variable name like estimatedWords.
| // Fast integer approximation: ~7 bytes per word in JSON | |
| bodyWords := bodyLength / 7 | |
| limitWords := MaxDebugBodyLength / 7 | |
| return fmt.Sprintf(`{"message":"Response body %d words (%d bytes) exceeds limit %d words (%d bytes). Use TRACE level to log and check content."}`, | |
| bodyWords, bodyLength, limitWords, MaxDebugBodyLength) | |
| // Fast integer approximation: ~7 bytes per word in JSON; this is an estimate, not an exact word count | |
| estimatedWords := bodyLength / 7 | |
| estimatedLimitWords := MaxDebugBodyLength / 7 | |
| return fmt.Sprintf(`{"message":"Response body estimated at %d words (%d bytes) exceeds limit of %d words (%d bytes). Use TRACE level to log and check content."}`, | |
| estimatedWords, bodyLength, estimatedLimitWords, MaxDebugBodyLength) |
|
/approve |
No description provided.