Skip to content

Commit 0520723

Browse files
committed
chore: reduce web backend log verbosity
- Reduce "Calculated usage and settled balance" DEBUG log to only include netBalance, usageThisCycle, grantsCount, isPersonalContext - Remove redundant console.log statements from auth redirect callback - Demote redirect-related logs from INFO to DEBUG level - Remove "chat completions request received" INFO log (redundant with analytics tracking)
1 parent f90210d commit 0520723

File tree

3 files changed

+4
-26
lines changed

3 files changed

+4
-26
lines changed

packages/billing/src/balance-calculator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ export async function calculateUsageAndBalance(
373373
logger.debug(
374374
{
375375
userId,
376-
balance,
376+
netBalance: balance.netBalance,
377377
usageThisCycle,
378378
grantsCount: grants.length,
379379
isPersonalContext,

web/src/app/api/auth/[...nextauth]/auth-options.ts

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -161,51 +161,30 @@ export const authOptions: NextAuthOptions = {
161161
return session
162162
},
163163
async redirect({ url, baseUrl }) {
164-
console.log('🟡 NextAuth redirect callback:', { url, baseUrl })
165-
166164
const potentialRedirectUrl = new URL(url, baseUrl)
167165
const authCode = potentialRedirectUrl.searchParams.get('auth_code')
168-
const referralCode =
169-
potentialRedirectUrl.searchParams.get('referral_code')
170-
171-
console.log('🟡 NextAuth redirect parsed params:', {
172-
authCode: !!authCode,
173-
referralCode,
174-
allParams: Object.fromEntries(
175-
potentialRedirectUrl.searchParams.entries(),
176-
),
177-
})
178166

179167
if (authCode) {
180168
const onboardUrl = new URL(`${baseUrl}/onboard`)
181169
potentialRedirectUrl.searchParams.forEach((value, key) => {
182170
onboardUrl.searchParams.set(key, value)
183171
})
184-
console.log('🟡 NextAuth CLI flow redirect to:', onboardUrl.toString())
185-
logger.info(
172+
logger.debug(
186173
{ url, authCode, redirectTarget: onboardUrl.toString() },
187174
'Redirecting CLI flow to /onboard',
188175
)
189176
return onboardUrl.toString()
190177
}
191178

192179
if (url.startsWith('/') || potentialRedirectUrl.origin === baseUrl) {
193-
console.log(
194-
'🟡 NextAuth web flow redirect to:',
195-
potentialRedirectUrl.toString(),
196-
)
197-
logger.info(
180+
logger.debug(
198181
{ url, redirectTarget: potentialRedirectUrl.toString() },
199182
'Redirecting web flow to callbackUrl',
200183
)
201184
return potentialRedirectUrl.toString()
202185
}
203186

204-
console.log(
205-
'🟡 NextAuth external/invalid URL, redirect to baseUrl:',
206-
baseUrl,
207-
)
208-
logger.info(
187+
logger.debug(
209188
{ url, baseUrl, redirectTarget: baseUrl },
210189
'Callback URL is external or invalid, redirecting to baseUrl',
211190
)

web/src/app/api/v1/chat/completions/_post.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ export async function postChatCompletions(params: {
166166
)
167167
}
168168

169-
logger.info({ userInfo, runId }, 'chat completions request received')
170169
// Track API request
171170
trackEvent({
172171
event: AnalyticsEvent.CHAT_COMPLETIONS_REQUEST,

0 commit comments

Comments
 (0)