MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / debugLog

Function debugLog

packages/core/src/debug-log/index.ts:39–60  ·  view source on GitHub ↗
(message: string, data?: unknown)

Source from the content-addressed store, hash-verified

37 * Only writes when enabled via setDebugLogEnabled(true).
38 */
39export function debugLog(message: string, data?: unknown): void {
40 if (!debugLogEnabled) {
41 return
42 }
43 try {
44 const logDir = path.dirname(DEBUG_LOG_PATH)
45
46 if (!fs.existsSync(logDir)) {
47 fs.mkdirSync(logDir, { recursive: true })
48 }
49
50 const timestamp = new Date().toISOString()
51
52 const entry = data
53 ? `[${timestamp}] ${message}: ${JSON.stringify(data, null, 2)}\n`
54 : `[${timestamp}] ${message}\n`
55
56 fs.appendFileSync(DEBUG_LOG_PATH, entry)
57 } catch {
58 // NO-OP - don't let logging errors break functionality
59 }
60}
61
62/**
63 * Debug logger with component context.

Callers 10

debugMethod · 0.70
warnMethod · 0.70
errorMethod · 0.70
handleAskMethod · 0.50
processMessageMethod · 0.50
handleStateMessageMethod · 0.50
handleMessageUpdatedMethod · 0.50
handleActionMethod · 0.50
handleInvokeMethod · 0.50
emitStateChangeEventsMethod · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected