feat(logging): order log fields for improved readability

This commit is contained in:
hkfires
2026-01-15 10:44:54 +08:00
parent 847be0e99d
commit 1fbbba6f59
3 changed files with 21 additions and 19 deletions

View File

@@ -149,7 +149,7 @@ func ApplyThinking(body []byte, model string, provider string) ([]byte, error) {
"provider": provider,
"model": modelInfo.ID,
"error": err.Error(),
}).Warn("thinking: validation failed, returning original body")
}).Warn("thinking: validation failed")
// Return original body on validation failure (defensive programming).
// This ensures callers who ignore the error won't receive nil body.
// The upstream service will decide how to handle the unmodified request.

View File

@@ -76,12 +76,10 @@ func ClampBudgetWithZeroCheck(value, min, max int, zeroAllowed bool) int {
return 0
}
log.WithFields(log.Fields{
"original_value": value,
"clamped_to": min,
"min": min,
"max": max,
"reason": "zero_not_allowed",
}).Warn("budget clamped: zero not allowed")
"clamped_to": min,
"min": min,
"max": max,
}).Warn("thinking: budget zero not allowed")
return min
}
@@ -253,8 +251,8 @@ func convertAutoToMidRange(config ThinkingConfig, support *registry.ThinkingSupp
func logClamp(original, clampedTo, min, max int) {
log.WithFields(log.Fields{
"original_value": original,
"clamped_to": clampedTo,
"min": min,
"max": max,
}).Debug("budget clamped: value outside model range")
"clamped_to": clampedTo,
}).Debug("thinking: budget clamped")
}