MCPcopy
hub / github.com/opentrace/opentrace / write

Function write

plugins/opencode/src/util/debug.ts:74–89  ·  view source on GitHub ↗
(line: string)

Source from the content-addressed store, hash-verified

72}
73
74function write(line: string): void {
75 if (++writesSinceCheck >= ROTATE_CHECK_INTERVAL) {
76 writesSinceCheck = 0
77 rotateIfNeeded()
78 }
79 // TUIs like OpenCode capture or overdraw stderr, so debug output is invisible
80 // in the user's terminal. Write to a file the user can tail from a second terminal.
81 // Also emit to stderr in case someone is running a non-TUI client.
82 try {
83 process.stderr.write(line)
84 } catch {}
85 try {
86 ensureLogDir()
87 appendFileSync(logFile, line)
88 } catch {}
89}
90
91export function debug(scope: string, ...parts: unknown[]): void {
92 if (!enabled) return

Callers 2

debugFunction · 0.70
configureDebugFunction · 0.70

Calls 3

rotateIfNeededFunction · 0.85
ensureLogDirFunction · 0.85
writeMethod · 0.80

Tested by

no test coverage detected