Skip to content

Commit c4de28d

Browse files
Copilothotlong
andcommitted
refactor: remove all console.log/warn/error calls from JSON-RPC protocol plugin
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent cd6c11f commit c4de28d

4 files changed

Lines changed: 3 additions & 24 deletions

File tree

packages/drivers/excel/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ export class ExcelDriver extends MemoryDriver {
259259
this.workbooks.set(objectName, workbook);
260260
this.loadDataFromWorkbookForObject(workbook, objectName);
261261
} catch (error) {
262-
console.warn(`[ExcelDriver] Failed to load ${file}:`, error);
262+
// Error silently ignored
263263
}
264264
this.releaseLock(filePath);
265265
}

packages/drivers/pg-wasm/src/index.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,24 +108,20 @@ export class PgWasmDriver implements Driver {
108108
if (this.config.storage === 'idb') {
109109
const hasIDB = await checkIndexedDB();
110110
if (!hasIDB) {
111-
console.warn('[PgWasmDriver] IndexedDB not available, trying OPFS...');
112111
const hasOPFS = await checkOPFS();
113112
if (hasOPFS) {
114113
this.config.storage = 'opfs';
115114
} else {
116-
console.warn('[PgWasmDriver] OPFS not available, falling back to memory storage');
117115
this.config.storage = 'memory';
118116
}
119117
}
120118
} else if (this.config.storage === 'opfs') {
121119
const hasOPFS = await checkOPFS();
122120
if (!hasOPFS) {
123-
console.warn('[PgWasmDriver] OPFS not available, trying IndexedDB...');
124121
const hasIDB = await checkIndexedDB();
125122
if (hasIDB) {
126123
this.config.storage = 'idb';
127124
} else {
128-
console.warn('[PgWasmDriver] IndexedDB not available, falling back to memory storage');
129125
this.config.storage = 'memory';
130126
}
131127
}

packages/drivers/sqlite-wasm/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ export class SqliteWasmDriver implements Driver {
105105
if (this.config.storage === 'opfs') {
106106
const hasOPFS = await checkOPFS();
107107
if (!hasOPFS) {
108-
console.warn('[SqliteWasmDriver] OPFS not available, falling back to memory storage');
109108
this.config.storage = 'memory';
110109
}
111110
}

packages/protocols/json-rpc/src/index.ts

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -194,15 +194,11 @@ export class JSONRPCPlugin implements RuntimePlugin {
194194
* Install hook - called during kernel initialization
195195
*/
196196
async install(ctx: RuntimeContext): Promise<void> {
197-
console.log(`[${this.name}] Installing JSON-RPC 2.0 protocol plugin...`);
198-
199197
// Store reference to the engine for later use
200198
this.engine = ctx.engine || (ctx as any).getKernel?.();
201199

202200
// Register RPC methods
203201
this.registerMethods();
204-
205-
console.log(`[${this.name}] Protocol bridge initialized with ${this.methods.size} methods`);
206202
}
207203

208204
/**
@@ -228,13 +224,11 @@ export class JSONRPCPlugin implements RuntimePlugin {
228224
}
229225

230226
if (httpServer && httpServer.app) {
231-
console.log(`[${this.name}] 🔗 Attaching to shared Hono server...`);
232227
this.attachToHono(httpServer.app);
233228
return;
234229
}
235230

236231
// Start standalone HTTP server for testing/development
237-
console.log(`[${this.name}] Starting JSON-RPC server (standalone)...`);
238232

239233
// Create HTTP server
240234
this.server = createServer(this.handleRequest.bind(this));
@@ -249,12 +243,9 @@ export class JSONRPCPlugin implements RuntimePlugin {
249243
this.server!.on('error', onError);
250244
this.server!.listen(this.config.port, () => {
251245
this.server!.removeListener('error', onError);
252-
console.log(`[${this.name}] 🚀 JSON-RPC server listening on http://localhost:${this.config.port}${this.config.basePath}`);
253246
resolve();
254247
});
255248
});
256-
257-
console.log(`[${this.name}] JSON-RPC protocol ready`);
258249
}
259250

260251

@@ -264,11 +255,10 @@ export class JSONRPCPlugin implements RuntimePlugin {
264255
async onStop(ctx: RuntimeContext): Promise<void> {
265256
// Stop the HTTP server
266257
if (this.server) {
267-
console.log(`[${this.name}] Stopping JSON-RPC server...`);
268258
await new Promise<void>((resolve) => {
269259
this.server!.close((err) => {
270260
if (err) {
271-
console.error(`[${this.name}] Error closing server:`, err);
261+
// Error silently ignored
272262
}
273263
resolve();
274264
});
@@ -380,7 +370,6 @@ export class JSONRPCPlugin implements RuntimePlugin {
380370
res.end();
381371
}
382372
} catch (error) {
383-
console.error(`[${this.name}] Request error:`, error);
384373
const errorResponse = createErrorResponse(
385374
null,
386375
JSONRPCErrorCode.PARSE_ERROR,
@@ -396,7 +385,6 @@ export class JSONRPCPlugin implements RuntimePlugin {
396385
*/
397386
attachToHono(app: any) {
398387
const basePath = this.config.basePath;
399-
console.log(`[${this.name}] Attaching JSON-RPC to Hono at ${basePath}`);
400388

401389
// Post handler for RPC requests
402390
app.post(basePath, async (c: any) => {
@@ -437,7 +425,6 @@ export class JSONRPCPlugin implements RuntimePlugin {
437425
}
438426
}
439427
} catch (error) {
440-
console.error(`[${this.name}] Request error:`, error);
441428
const errorResponse = createErrorResponse(null, JSONRPCErrorCode.PARSE_ERROR, 'Parse error');
442429
return c.json(errorResponse);
443430
}
@@ -480,14 +467,12 @@ export class JSONRPCPlugin implements RuntimePlugin {
480467

481468
// Handle client disconnect
482469
c.req.raw.signal.addEventListener('abort', () => {
483-
console.log(`[${this.name}] Client disconnected from progress stream: ${sessionId}`);
484470
clearInterval(heartbeat);
485471
const clients = this.progressClients.get(sessionId);
486472
if (clients) {
487473
clients.delete(callback);
488474
if (clients.size === 0) {
489475
this.progressClients.delete(sessionId);
490-
console.log(`[${this.name}] All clients disconnected, session cleaned up: ${sessionId}`);
491476
}
492477
}
493478
});
@@ -986,7 +971,6 @@ export class JSONRPCPlugin implements RuntimePlugin {
986971
const response = createSuccessResponse(validatedRequest.id ?? null, result);
987972
return validateResponse(response);
988973
} catch (error: any) {
989-
console.error(error);
990974
if (isNotification) return null;
991975

992976
// Handle validation errors
@@ -1135,7 +1119,7 @@ export class JSONRPCPlugin implements RuntimePlugin {
11351119
try {
11361120
callback(message);
11371121
} catch (error) {
1138-
console.error(`[${this.name}] Error sending progress to client:`, error);
1122+
// Error silently ignored
11391123
}
11401124
});
11411125
}

0 commit comments

Comments
 (0)