Skip to content

Commit be5c151

Browse files
committed
fix: Improve backend HTTP request log visibility in System Messages
- Enhanced server log detection to catch Flask/Django HTTP request logs - Backend server logs like 'INFO: 127.0.0.1:63021 - "OPTIONS /api/newsletters HTTP/1.1" 200 OK' now appear in System Messages console - Improved pattern matching for HTTP request methods (OPTIONS, GET, POST, PUT, DELETE, PATCH) - Server startup messages also now visible in System Messages for better debugging
1 parent a00179e commit be5c151

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/ipc/handlers/terminal_handlers.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,22 @@ export function routeTerminalOutput(event: Electron.IpcMainInvokeEvent, appId: n
109109
let systemMessageType = type;
110110
let systemMessage = message;
111111

112-
// For backend server logs, enhance visibility
113-
if (terminalType === "backend" && (message.includes("HTTP/") || message.includes("OPTIONS") || message.includes("GET") || message.includes("POST") || message.includes("PUT") || message.includes("DELETE"))) {
114-
systemMessageType = "info"; // Use info type to make server logs stand out
115-
systemMessage = `[${terminalType.toUpperCase()}] ${message}`;
112+
// For backend server logs, enhance visibility - check for various server log patterns
113+
if (terminalType === "backend") {
114+
// Check for HTTP request logs from Flask/Django/FastAPI/Node.js servers
115+
const isHttpRequestLog = (
116+
// Flask/Django format: "INFO: 127.0.0.1:63021 - "OPTIONS /api/newsletters HTTP/1.1" 200 OK"
117+
(message.includes("HTTP/") && (message.includes("OPTIONS") || message.includes("GET") || message.includes("POST") || message.includes("PUT") || message.includes("DELETE") || message.includes("PATCH"))) ||
118+
// General server response patterns
119+
(message.includes("HTTP/") || message.includes("status") || message.includes("OK") || message.includes("ERROR")) ||
120+
// Server startup messages
121+
(message.includes("Running on") || message.includes("Server running") || message.includes("listening on") || message.includes("started"))
122+
);
123+
124+
if (isHttpRequestLog) {
125+
systemMessageType = "info"; // Use info type to make server logs stand out
126+
systemMessage = `[${terminalType.toUpperCase()}] ${message}`;
127+
}
116128
}
117129

118130
// Always send to system messages for visibility

0 commit comments

Comments
 (0)