MCPcopy Create free account
hub / github.com/Sandpack/nodebox-runtime / createDebug

Function createDebug

packages/nodebox/src/logger.ts:26–38  ·  view source on GitHub ↗
(scope: Scope)

Source from the content-addressed store, hash-verified

24};
25
26export function createDebug(scope: Scope) {
27 return function debug(message: string, ...data: any[]) {
28 if (FLAG === 'true') {
29 const direction = () => {
30 if (message.includes('sender')) return `${GREEN}sender`;
31 if (message.includes('receiver')) return `${RED}receiver`;
32 return '';
33 };
34 const cleanMessage = message.replace(/\[.+\]:/, '');
35 console.debug(`${COLOR_SCOPE[scope]}${scope}:${direction()}${DEFAULT}:${cleanMessage}`, ...data);
36 }
37 };
38}

Callers 2

Nodebox.tsFile · 0.90
messages.tsFile · 0.90

Calls 1

directionFunction · 0.85

Tested by

no test coverage detected