fix: remove debug console.logs and use logger in library modules#613
fix: remove debug console.logs and use logger in library modules#613ashsolei wants to merge 1 commit intoczlonkowski:mainfrom
Conversation
- Remove leftover DEBUG console.log statements from config-validator.ts that could corrupt JSON-RPC stream in stdio mode - Replace bare console.log/warn/error in docs-mapper.ts with logger utility that respects MCP_MODE and suppresses output in stdio mode - Replace bare console.log/warn/error in node-loader.ts with logger utility for consistent logging behavior
There was a problem hiding this comment.
Pull request overview
This PR removes leftover direct console.* output from library modules and routes operational/debug logging through the project logger utility to avoid corrupting stdio JSON-RPC streams (and to respect MCP_MODE-based suppression).
Changes:
- Removed a debug-only
console.logblock fromConfigValidator’s Python return-format checks. - Replaced
console.logusage inDocsMapperwithlogger.warn/logger.debug. - Replaced
console.log/warn/errorusage inN8nNodeLoaderwithlogger.info/debug/warn/error.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/services/config-validator.ts | Removes debug console.log statements that could interfere with stdio transports. |
| src/mappers/docs-mapper.ts | Uses the shared logger for docs lookup logging (warn/debug). |
| src/loaders/node-loader.ts | Uses the shared logger for package/node loading logs; updates error/warn/info/debug paths. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| results.push(...nodes); | ||
| } catch (error) { | ||
| console.error(`Failed to load ${pkg.name}:`, error); | ||
| logger.error(`Failed to load ${pkg.name}: ${error}`); |
There was a problem hiding this comment.
loadAllNodes() catch block interpolates the caught error into the message (${error}), which can degrade diagnostics (e.g., [object Object]) and drop stack traces. Since the project logger supports variadic args, pass the error as a separate argument (or log error instanceof Error ? error.message/stack : String(error)) so stack/metadata is preserved (see similar logger.error(msg, error) usage in src/http-server.ts).
| logger.error(`Failed to load ${pkg.name}: ${error}`); | |
| logger.error(`Failed to load ${pkg.name}`, error); |
|
Closing — will maintain fixes in a private mirror instead. Thank you for the review. |
Summary
Remove leftover debug
console.logstatements and replace bareconsole.log/warn/errorcalls with the project'sloggerutility in library modules.Problem
config-validator.tscontained 3 leftoverconsole.log('DEBUG: ...')statements inside a conditional block. In stdio mode, any directconsole.logoutput corrupts the JSON-RPC transport stream.docs-mapper.tsandnode-loader.tsused bareconsole.log/warn/errorfor operational logging instead of the project'sloggerutility, which properly suppresses output in stdio mode via theMCP_MODEenvironment variable check.Changes
src/services/config-validator.tsconsole.log('DEBUG: ...')statements and their containing conditional blocksrc/mappers/docs-mapper.tsconsole.logcalls withlogger.warn/logger.debugsrc/loaders/node-loader.tsconsole.log/warn/errorcalls withlogger.info/debug/warn/errorTesting
loggerutility is already well-tested and used throughout the codebase (18+ existing imports)MCP_MODEis not set