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

Function logForDebugging

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

Source from the content-addressed store, hash-verified

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

Callers 15

maybeGenerateTaskSummaryFunction · 0.70
mtls.tsFile · 0.70
getTLSFetchOptionsFunction · 0.70
clearMTLSCacheFunction · 0.70
configureGlobalMTLSFunction · 0.70
parseFrontmatterFunction · 0.70
parseShellFrontmatterFunction · 0.70
fileHistoryTrackEditFunction · 0.70
fileHistoryMakeSnapshotFunction · 0.70
fileHistoryRewindFunction · 0.70
applySnapshotFunction · 0.70

Calls 5

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

Tested by

no test coverage detected