Skip to content

Commit cf30565

Browse files
Copilothotlong
andcommitted
refactor: remove all console.log/warn/error/debug calls from RedisDriver
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 04ae4ab commit cf30565

1 file changed

Lines changed: 8 additions & 25 deletions

File tree

packages/drivers/redis/src/index.ts

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -190,35 +190,28 @@ export class RedisDriver implements Driver {
190190
reconnectStrategy: (retries: number) => {
191191
// Implement exponential backoff for reconnection
192192
if (retries > (this.config.retry?.maxAttempts ?? 10)) {
193-
console.error('[RedisDriver] Max reconnection attempts reached');
194193
return new Error('Max reconnection attempts reached');
195194
}
196195

197196
const delay = this.calculateRetryDelay(retries);
198-
console.log(`[RedisDriver] Reconnecting in ${delay}ms (attempt ${retries})`);
199197
return delay;
200198
}
201199
},
202200
...this.config.options
203201
}) as RedisClientType;
204202

205203
// Handle connection errors with enhanced logging
206-
this.client.on('error', (err: Error) => {
207-
console.error('[RedisDriver] Connection error:', err.message);
208-
if (err.stack) {
209-
console.debug('[RedisDriver] Error stack:', err.stack);
210-
}
204+
this.client.on('error', (_err: Error) => {
205+
// Error silently ignored
211206
});
212207

213208
// Handle successful reconnection
214209
this.client.on('reconnecting', () => {
215210
this.reconnecting = true;
216-
console.log('[RedisDriver] Attempting to reconnect...');
217211
});
218212

219213
this.client.on('ready', () => {
220214
if (this.reconnecting) {
221-
console.log('[RedisDriver] Successfully reconnected');
222215
this.reconnecting = false;
223216
}
224217
});
@@ -250,15 +243,12 @@ export class RedisDriver implements Driver {
250243
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
251244
try {
252245
await this.client.connect();
253-
console.log('[RedisDriver] Successfully connected to Redis');
254246
return;
255247
} catch (error) {
256248
lastError = error as Error;
257-
console.error(`[RedisDriver] Connection attempt ${attempt}/${maxAttempts} failed:`, error);
258249

259250
if (attempt < maxAttempts) {
260251
const delay = this.calculateRetryDelay(attempt);
261-
console.log(`[RedisDriver] Retrying in ${delay}ms...`);
262252
await new Promise(resolve => setTimeout(resolve, delay));
263253
}
264254
}
@@ -280,10 +270,8 @@ export class RedisDriver implements Driver {
280270
await this.client.ping();
281271
const latency = Date.now() - start;
282272

283-
console.debug(`[RedisDriver] Health check passed (latency: ${latency}ms)`);
284273
return true;
285274
} catch (error) {
286-
console.error('[RedisDriver] Health check failed:', error);
287275
return false;
288276
}
289277
}
@@ -313,11 +301,10 @@ export class RedisDriver implements Driver {
313301
const doc = JSON.parse(data);
314302
results.push(doc);
315303
} catch (error) {
316-
console.warn(`[RedisDriver] Failed to parse document at key ${key}:`, error);
304+
// Error silently ignored
317305
}
318306
}
319307
}
320-
321308
// Apply filters (in-memory)
322309
if (normalizedQuery.filters) {
323310
results = this.applyFilters(results, normalizedQuery.filters);
@@ -362,7 +349,7 @@ export class RedisDriver implements Driver {
362349
try {
363350
return JSON.parse(data);
364351
} catch (error) {
365-
console.warn(`[RedisDriver] Failed to parse document at key ${key}:`, error);
352+
// Error silently ignored
366353
return null;
367354
}
368355
}
@@ -490,7 +477,7 @@ export class RedisDriver implements Driver {
490477
count++;
491478
}
492479
} catch (error) {
493-
console.warn(`[RedisDriver] Failed to parse document at key ${key}:`, error);
480+
// Error silently ignored
494481
}
495482
}
496483
}
@@ -566,7 +553,7 @@ export class RedisDriver implements Driver {
566553
}
567554
}
568555
} catch (error) {
569-
console.warn(`[RedisDriver] Failed to parse document at key ${key}:`, error);
556+
// Error silently ignored
570557
}
571558
}
572559
}
@@ -627,7 +614,7 @@ export class RedisDriver implements Driver {
627614
const doc = JSON.parse(data);
628615
records.push(doc);
629616
} catch (error) {
630-
console.warn(`[RedisDriver] Failed to parse document at key ${key}:`, error);
617+
// Error silently ignored
631618
}
632619
}
633620
}
@@ -671,7 +658,7 @@ export class RedisDriver implements Driver {
671658
break;
672659

673660
default:
674-
console.warn(`[RedisDriver] Unsupported aggregation stage: ${stageName}`);
661+
break;
675662
}
676663
}
677664

@@ -1013,7 +1000,6 @@ export class RedisDriver implements Driver {
10131000
return result.length > 0 ? result : undefined;
10141001
} else if (condition.type === 'not') {
10151002
// Handle NOT filter: { type: 'not', child: {...} }
1016-
console.warn('[RedisDriver] NOT operator in filters is not fully supported in legacy format');
10171003
if (condition.child) {
10181004
return this.convertFilterConditionToArray(condition.child);
10191005
}
@@ -1048,7 +1034,6 @@ export class RedisDriver implements Driver {
10481034
}
10491035
} else if (key === '$not' && typeof value === 'object') {
10501036
// Handle $not: { condition }
1051-
console.warn('[RedisDriver] NOT operator in filters is not fully supported in legacy format');
10521037
const converted = this.convertFilterConditionToArray(value);
10531038
if (converted) {
10541039
result.push(...converted);
@@ -1256,7 +1241,6 @@ export class RedisDriver implements Driver {
12561241
case 'contains':
12571242
return String(fieldValue).toLowerCase().includes(String(compareValue).toLowerCase());
12581243
default:
1259-
console.warn(`[RedisDriver] Unsupported operator: ${operator}`);
12601244
return false;
12611245
}
12621246
}
@@ -1427,7 +1411,6 @@ export class RedisDriver implements Driver {
14271411
});
14281412

14291413
default:
1430-
console.warn(`[RedisDriver] Unsupported aggregation operator: ${operator}`);
14311414
return null;
14321415
}
14331416
}

0 commit comments

Comments
 (0)