🌳
pt0/serverF/libFs/mcpDebugLogF.mts
1import { appendFileSync } from 'fs'
4const logPath = `${ptTmpDir}/mcp-debug.log`
6// In MCP mode: write to log file to avoid glitchy stderr output in terminal UI
7// In CLI mode: print to stdout for normal visibility
8export const mcpDebugLog = (msg: string) => {
9 if (process.env.OPENCODE) {
11 appendFileSync(logPath, `${new Date().toISOString()} ${msg}\n`)
12 } else {
13 console.log(msg)
14 }
17// Verbose debug logging - disabled by default, enable when debugging
18export const mcpVerboseLog = (msg: string) => {
19 return // disabled - remove this line to enable verbose logging
20 mcpDebugLog(msg)