From 6fc23568dfe266377478a0dfc4f949fdf697f90a Mon Sep 17 00:00:00 2001 From: sususu98 Date: Sun, 26 Apr 2026 23:04:06 +0800 Subject: [PATCH] logging: mark antigravity credits requests --- internal/logging/gin_logger.go | 20 ++++++++++++++++++- .../runtime/executor/antigravity_executor.go | 4 ++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/internal/logging/gin_logger.go b/internal/logging/gin_logger.go index d92ae985e..4d6d088c0 100644 --- a/internal/logging/gin_logger.go +++ b/internal/logging/gin_logger.go @@ -27,7 +27,10 @@ var aiAPIPrefixes = []string{ "/api/provider/", } -const skipGinLogKey = "__gin_skip_request_logging__" +const ( + skipGinLogKey = "__gin_skip_request_logging__" + creditsUsedKey = "__antigravity_credits_used__" +) // GinLogrusLogger returns a Gin middleware handler that logs HTTP requests and responses // using logrus. It captures request details including method, path, status code, latency, @@ -79,6 +82,9 @@ func GinLogrusLogger() gin.HandlerFunc { requestID = "--------" } logLine := fmt.Sprintf("%3d | %13v | %15s | %-7s \"%s\"", statusCode, latency, clientIP, method, path) + if creditsUsed(c) { + logLine += " [credits]" + } if errorMessage != "" { logLine = logLine + " | " + errorMessage } @@ -149,3 +155,15 @@ func shouldSkipGinRequestLogging(c *gin.Context) bool { flag, ok := val.(bool) return ok && flag } + +func creditsUsed(c *gin.Context) bool { + if c == nil { + return false + } + val, exists := c.Get(creditsUsedKey) + if !exists { + return false + } + flag, ok := val.(bool) + return ok && flag +} diff --git a/internal/runtime/executor/antigravity_executor.go b/internal/runtime/executor/antigravity_executor.go index 6983bface..665749343 100644 --- a/internal/runtime/executor/antigravity_executor.go +++ b/internal/runtime/executor/antigravity_executor.go @@ -2242,9 +2242,9 @@ var antigravityBaseURLFallbackOrder = func(auth *cliproxyauth.Auth) []string { return []string{base} } return []string{ - antigravityBaseURLProd, antigravityBaseURLDaily, - antigravitySandboxBaseURLDaily, + antigravityBaseURLProd, + // antigravitySandboxBaseURLDaily, } }