refactor(apic): reduce LAPI client debug log verbosity#4136
refactor(apic): reduce LAPI client debug log verbosity#4136LaurenceJJones wants to merge 1 commit intocrowdsecurity:masterfrom
Conversation
Move verbose debug logs to trace level: - Headers loop and full response dumps in client_http.go - Token expiration and scenario update messages in auth_jwt.go - Error response status messages in auth_jwt.go Keep essential debug info (request URLs, response codes) visible. Standardize response code format to 'http %d' for consistency.
|
@LaurenceJJones: There are no 'kind' label on this PR. You need a 'kind' label to generate the release automatically.
DetailsI am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository. |
|
@LaurenceJJones: There are no area labels on this PR. You can add as many areas as you see fit.
DetailsI am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository. |
|
|
||
| if resp.StatusCode < 200 || resp.StatusCode >= 300 { | ||
| log.Debugf("received response status %q when fetching %v", resp.Status, req.URL) | ||
| log.Tracef("received response status %q when fetching %v", resp.Status, req.URL) |
There was a problem hiding this comment.
might be useful at debug level 🤷🏻 but we already log the status anyways and URL so this could be removed?
| } | ||
|
|
||
| log.Debugf("token %s will expire on %s", t.Token, t.Expiration.String()) | ||
| if log.IsLevelEnabled(log.TraceLevel) { |
There was a problem hiding this comment.
wrapped because t....String() causes allocation
There was a problem hiding this comment.
but %v doesnt log as human readable no?
There was a problem hiding this comment.
Ignore structs and funny types for a moment.
...
The default format for %v is:
bool: %t
int, int8 etc.: %d
uint, uint8 etc.: %d, %#x if printed with %#v
float32, complex64, etc: %g
string: %s
chan: %p
pointer: %p
...
If the format (which is implicitly %v for Println etc.) is valid for a string (%s %q %x %X), or is %v but not %#v, the following two rules apply:
-
If an operand implements the error interface, the Error method will be invoked to convert the object to a string, which will then be formatted as required by the verb (if any).
-
If an operand implements method String() string, that method will be invoked to convert the object to a string, which will then be formatted as required by the verb (if any).
|
/kind refactoring |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4136 +/- ##
==========================================
+ Coverage 62.86% 62.91% +0.05%
==========================================
Files 464 464
Lines 33290 33349 +59
==========================================
+ Hits 20927 20983 +56
Misses 10241 10241
- Partials 2122 2125 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Move verbose debug logs to trace level:
Keep essential debug info (request URLs, response codes) visible. Standardize response code format to 'http %d' for consistency.