Skip to content

Commit 7110aee

Browse files
committed
refactor(backend): change logger level from info to trace for detailed logging
1 parent 6d19952 commit 7110aee

File tree

12 files changed

+31
-31
lines changed

12 files changed

+31
-31
lines changed

services/backend/src/cron/cronManager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export class CronManager {
6262

6363
try {
6464
const task = cron.schedule(schedule, async () => {
65-
this.logger.info({
65+
this.logger.trace({
6666
job: jobName,
6767
jobType,
6868
schedule,
@@ -81,7 +81,7 @@ export class CronManager {
8181
maxAttempts ? { maxAttempts } : undefined
8282
);
8383

84-
this.logger.info({
84+
this.logger.trace({
8585
job: jobName,
8686
jobId: job.id,
8787
jobType,

services/backend/src/hooks/authHook.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ export async function authHook(
3737
const sessionId = lucia.readSessionCookie(request.headers.cookie ?? '');
3838

3939
if (!sessionId) {
40-
request.log.debug('Auth hook: No session cookie found');
40+
request.log.trace('Auth hook: No session cookie found');
4141
request.user = null;
4242
request.session = null;
4343
return; // Proceed as unauthenticated
4444
}
4545

46-
request.log.debug(`Auth hook: Found session ID: ${sessionId}`);
46+
request.log.trace(`Auth hook: Found session ID: ${sessionId}`);
4747

4848
// Manual session validation to avoid Lucia SQL syntax issues
4949
const db = getDb();
@@ -66,7 +66,7 @@ export async function authHook(
6666
.limit(1);
6767

6868
if (sessionResult.length === 0) {
69-
request.log.debug(`Auth hook: Session ${sessionId} not found`);
69+
request.log.trace(`Auth hook: Session ${sessionId} not found`);
7070
const sessionCookie = lucia.createBlankSessionCookie();
7171
reply.setCookie(sessionCookie.name, sessionCookie.value, sessionCookie.attributes);
7272
request.user = null;
@@ -78,7 +78,7 @@ export async function authHook(
7878

7979
// Check if session is expired
8080
if (sessionData.expiresAt < Date.now()) {
81-
request.log.debug(`Auth hook: Session ${sessionId} is expired`);
81+
request.log.trace(`Auth hook: Session ${sessionId} is expired`);
8282
// Delete expired session
8383
await db.delete(authSession).where(eq(authSession.id, sessionId));
8484
const sessionCookie = lucia.createBlankSessionCookie();
@@ -106,8 +106,8 @@ export async function authHook(
106106
fresh: false
107107
};
108108

109-
request.log.debug(`Auth hook: Session ${sessionId} is valid for user ${user.id}`);
110-
109+
request.log.trace(`Auth hook: Session ${sessionId} is valid for user ${user.id}`);
110+
111111
request.user = user;
112112
request.session = session;
113113
// No explicit done() call, Fastify awaits the promise

services/backend/src/middleware/oauthMiddleware.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export function requireOAuthScope(requiredScope: string) {
100100
// Skip scope check if user authenticated via cookie (not OAuth2)
101101
if (!request.tokenPayload) {
102102
// User authenticated via cookie session - skip OAuth scope validation
103-
request.log.debug({
103+
request.log.trace({
104104
operation: 'oauth_scope_check',
105105
userId: request.user?.id,
106106
requiredScope,
@@ -147,7 +147,7 @@ export function requireAnyOAuthScope(requiredScopes: string[]) {
147147
// Skip scope check if user authenticated via cookie (not OAuth2)
148148
if (!request.tokenPayload) {
149149
// User authenticated via cookie session - skip OAuth scope validation
150-
request.log.debug({
150+
request.log.trace({
151151
operation: 'oauth_scope_check',
152152
userId: request.user?.id,
153153
requiredScopes,
@@ -244,7 +244,7 @@ export function requireAuthenticationAny() {
244244
return async (request: FastifyRequest, reply: FastifyReply) => {
245245
// Check if user is already authenticated via cookie (from authHook)
246246
if (request.user && request.session) {
247-
request.log.debug({
247+
request.log.trace({
248248
operation: 'dual_auth_middleware',
249249
userId: request.user.id,
250250
authType: 'cookie',

services/backend/src/middleware/roleMiddleware.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ export function requireTeamPermission(
336336

337337
const userId = request.user.id;
338338

339-
request.log.debug({
339+
request.log.trace({
340340
operation: 'team_permission_check',
341341
userId,
342342
teamId,

services/backend/src/middleware/satelliteAuthMiddleware.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export function requireUserOrSatelliteAuth() {
130130
return async (request: FastifyRequest, reply: FastifyReply) => {
131131
// Check if user is already authenticated via cookie (from authHook)
132132
if (request.user && request.session) {
133-
request.log.debug({
133+
request.log.trace({
134134
operation: 'hybrid_auth_middleware',
135135
userId: request.user.id,
136136
authType: 'user_cookie',

services/backend/src/routes/mcp/categories/list.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export default async function listCategories(server: FastifyInstance) {
7979
const authType = request.tokenPayload ? 'oauth2' : 'cookie';
8080
const userId = request.user.id;
8181

82-
request.log.debug({
82+
request.log.trace({
8383
operation: 'list_mcp_categories',
8484
userId,
8585
authType,

services/backend/src/services/jobProcessorService.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,13 @@ export class JobProcessorService {
146146
}
147147

148148
// Execute the worker
149-
this.logger.info({ jobId: job.id, jobType: job.type, attempt: job.attempts + 1 }, 'Executing job');
150-
149+
this.logger.trace({ jobId: job.id, jobType: job.type, attempt: job.attempts + 1 }, 'Executing job');
150+
151151
const result: WorkerResult = await worker.execute(payload, job.id);
152152

153153
if (result.success) {
154154
await this.jobQueueService.updateJobStatus(job.id, 'completed', undefined, result.data);
155-
this.logger.info({ jobId: job.id, jobType: job.type }, 'Job completed successfully');
155+
this.logger.trace({ jobId: job.id, jobType: job.type }, 'Job completed successfully');
156156

157157
// Update batch progress if job is part of a batch
158158
if (job.batch_id) {

services/backend/src/services/jobQueueService.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ export class JobQueueService {
5656
};
5757

5858
await this.db.insert(this.queueJobs).values(jobData);
59-
60-
this.logger.info({ jobId, type, scheduledFor, batchId }, 'Job created');
61-
59+
60+
this.logger.trace({ jobId, type, scheduledFor, batchId }, 'Job created');
61+
6262
return jobData as Job;
6363
} catch (error) {
6464
this.logger.error({ error, type }, 'Failed to create job');
@@ -110,7 +110,7 @@ export class JobQueueService {
110110
})
111111
.where(eq(this.queueJobs.id, jobId));
112112

113-
this.logger.debug({ jobId }, 'Job marked as processing');
113+
this.logger.trace({ jobId }, 'Job marked as processing');
114114
} catch (error) {
115115
this.logger.error({ error, jobId }, 'Failed to mark job as processing');
116116
throw error;
@@ -145,7 +145,7 @@ export class JobQueueService {
145145
.set(updateData)
146146
.where(eq(this.queueJobs.id, jobId));
147147

148-
this.logger.info({ jobId, status, error }, 'Job status updated');
148+
this.logger.trace({ jobId, status, error }, 'Job status updated');
149149
} catch (error) {
150150
this.logger.error({ error, jobId, status }, 'Failed to update job status');
151151
throw error;

services/backend/src/services/mcpHealthCheckService.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -676,14 +676,14 @@ export class McpHealthCheckService {
676676
oauthFailed: number;
677677
apiKeyRequested: number;
678678
}> {
679-
this.logger.info({
679+
this.logger.trace({
680680
operation: 'credential_validation_started'
681681
}, 'Starting credential validation run');
682682

683683
const installations = await this.getInstallationsNeedingCredentialCheck();
684684

685685
if (installations.length === 0) {
686-
this.logger.debug({
686+
this.logger.trace({
687687
operation: 'credential_validation_complete',
688688
installationsChecked: 0
689689
}, 'No installations need credential validation');
@@ -755,7 +755,7 @@ export class McpHealthCheckService {
755755
}
756756
}
757757

758-
this.logger.info({
758+
this.logger.trace({
759759
operation: 'credential_validation_complete',
760760
installationsChecked: installations.length,
761761
oauthValidated,

services/backend/src/workers/cleanupMcpServerLogsWorker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class CleanupMcpServerLogsWorker implements Worker {
3434

3535
const { maxLogsPerInstallation } = payload as CleanupPayload;
3636

37-
this.logger.info({
37+
this.logger.trace({
3838
jobId,
3939
maxLogsPerInstallation,
4040
operation: 'cleanup_mcp_server_logs'
@@ -59,7 +59,7 @@ export class CleanupMcpServerLogsWorker implements Worker {
5959

6060
const totalDeleted = serverLogsDeleted + requestLogsDeleted;
6161

62-
this.logger.info({
62+
this.logger.trace({
6363
jobId,
6464
serverLogsDeleted,
6565
requestLogsDeleted,

0 commit comments

Comments
 (0)