MCPcopy Create free account
hub / github.com/ShipSecAI/studio / writeLog

Method writeLog

worker/src/utils/debug-logger.ts:34–55  ·  view source on GitHub ↗
(level: string, message: string, data?: unknown)

Source from the content-addressed store, hash-verified

32 }
33
34 private writeLog(level: string, message: string, data?: unknown) {
35 const entry: LogEntry = {
36 timestamp: new Date().toISOString(),
37 level: level as 'debug' | 'info' | 'warn' | 'error',
38 context: this.context,
39 message,
40 data,
41 };
42
43 // Write to file
44 try {
45 const logLine = JSON.stringify(entry);
46 fs.appendFileSync(DEBUG_LOG_FILE, logLine + '\n');
47 } catch (_err) {
48 // Silently fail if we can't write
49 }
50
51 // Also log to console if enabled
52 if (this.enableConsole) {
53 console.log(`[${entry.timestamp}] [${level}] [${this.context}] ${message}`, data ? data : '');
54 }
55 }
56
57 debug(message: string, data?: unknown) {
58 this.writeLog('debug', message, data);

Callers 4

debugMethod · 0.95
infoMethod · 0.95
warnMethod · 0.95
errorMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected