MCPcopy
hub / github.com/prisma/prisma / debugCall

Function debugCall

packages/debug/src/index.ts:92–123  ·  view source on GitHub ↗
(...args: any[])

Source from the content-addressed store, hash-verified

90 }
91
92 const debugCall = (...args: any[]) => {
93 const { enabled, namespace, color, log } = instanceProps
94
95 // we push the args to our history of args
96 if (args.length !== 0) {
97 argsHistory.push([namespace, ...args])
98 }
99
100 // if it is too big, then we remove some
101 if (argsHistory.length > MAX_ARGS_HISTORY) {
102 argsHistory.shift()
103 }
104
105 if (topProps.enabled(namespace) || enabled) {
106 const stringArgs = args.map((arg) => {
107 if (typeof arg === 'string') {
108 return arg
109 }
110
111 return safeStringify(arg)
112 })
113
114 const ms = `+${Date.now() - lastTimestamp}ms`
115 lastTimestamp = Date.now()
116
117 if (globalThis.DEBUG_COLORS) {
118 log(kleur[color](bold(namespace)), ...stringArgs, kleur[color](ms))
119 } else {
120 log(namespace, ...stringArgs, ms)
121 }
122 }
123 }
124
125 return new Proxy(debugCall, {
126 get: (_, prop) => instanceProps[prop],

Callers

nothing calls this directly

Calls 3

safeStringifyFunction · 0.85
logFunction · 0.50
pushMethod · 0.45

Tested by

no test coverage detected