(...args: any[])
| 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], |
nothing calls this directly
no test coverage detected