MCPcopy
hub / github.com/codeaashu/claude-code / logForDebugging

Function logForDebugging

src/utils/debug.ts:203–228  ·  view source on GitHub ↗
(
  message: string,
  { level }: { level: DebugLogLevel } = {
    level: 'debug',
  },
)

Source from the content-addressed store, hash-verified

201}
202
203export function logForDebugging(
204 message: string,
205 { level }: { level: DebugLogLevel } = {
206 level: 'debug',
207 },
208): void {
209 if (LEVEL_ORDER[level] < LEVEL_ORDER[getMinDebugLogLevel()]) {
210 return
211 }
212 if (!shouldLogDebugMessage(message)) {
213 return
214 }
215
216 // Multiline messages break the jsonl output format, so make any multiline messages JSON.
217 if (hasFormattedOutput && message.includes('\n')) {
218 message = jsonStringify(message)
219 }
220 const timestamp = new Date().toISOString()
221 const output = `${timestamp} [${level.toUpperCase()}] ${message.trim()}\n`
222 if (isDebugToStdErr()) {
223 writeToStderr(output)
224 return
225 }
226
227 getDebugWriter().write(output)
228}
229
230export function getDebugLogPath(): string {
231 return (

Callers 15

makeLogEntryReaderFunction · 0.85
immediateFlushHistoryFunction · 0.85
getSkillsFunction · 0.85
commands.tsFile · 0.85
queryLoopFunction · 0.85
runFunction · 0.85
connectMcpBatchFunction · 0.85
formatCommandDescriptionFunction · 0.85
executeForkedSkillFunction · 0.85
callFunction · 0.85
executeRemoteSkillFunction · 0.85
maybeInvalidateCacheFunction · 0.85

Calls 5

shouldLogDebugMessageFunction · 0.85
jsonStringifyFunction · 0.85
writeToStderrFunction · 0.85
getDebugWriterFunction · 0.85
writeMethod · 0.45

Tested by

no test coverage detected