MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / captureLog

Function captureLog

bin/mcp-server.js:871–878  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

869 const consoleMethods = ['log', 'info', 'warn', 'error', 'debug']
870 const origConsoleMethods = {}
871 const captureLog = level => (...args) => {
872 if (consoleLogs.length >= MAX_LOG_ENTRIES) return
873 const message = args.map(a => {
874 if (typeof a === 'string') return a
875 return truncateString(safeStringify(a, [], 2), MAX_LOG_MSG_BYTES).value
876 }).join(' ')
877 consoleLogs.push({ level, message, t: Date.now() - startedAt })
878 }
879 for (const m of consoleMethods) {
880 origConsoleMethods[m] = console[m]
881 console[m] = captureLog(m)

Callers 1

mcp-server.jsFile · 0.85

Calls 3

truncateStringFunction · 0.90
safeStringifyFunction · 0.90
pushMethod · 0.80

Tested by

no test coverage detected