@imenam/mcp-gui-interface 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/logger.js +12 -6
- package/package.json +1 -1
package/dist/src/logger.js
CHANGED
|
@@ -41,12 +41,18 @@ export function setupLogging(options) {
|
|
|
41
41
|
return;
|
|
42
42
|
currentProcessLabel = options.processLabel;
|
|
43
43
|
const resolvedLogDir = options.logDir ?? process.env.MCP_LOG_DIR ?? path.join(process.cwd(), ".mcp-gui", "logs");
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
try {
|
|
45
|
+
fs.mkdirSync(resolvedLogDir, { recursive: true });
|
|
46
|
+
const logFilePath = path.join(resolvedLogDir, "server.log");
|
|
47
|
+
logStream = fs.createWriteStream(logFilePath, { flags: "a", encoding: "utf8" });
|
|
48
|
+
logStream.on("error", (error) => {
|
|
49
|
+
logStream = null;
|
|
50
|
+
originalConsoleError(`[LOGGER] Log file write failed, disabling file logging: ${serialize(error)}`);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
originalConsoleError(`[LOGGER] Could not initialize log file at "${resolvedLogDir}", disabling file logging: ${serialize(error)}`);
|
|
55
|
+
}
|
|
50
56
|
ensureConsoleErrorPatched();
|
|
51
57
|
// Redirect console.log/info/warn to console.error to protect stdout
|
|
52
58
|
// which is reserved for the MCP JSON-RPC protocol in the MASTER process.
|
package/package.json
CHANGED