MCPcopy Index your code
hub / github.com/TanStack/db / debugLog

Function debugLog

packages/db/src/proxy.ts:459–477  ·  view source on GitHub ↗

* Simple debug utility that only logs when debug mode is enabled * Set DEBUG to true in localStorage to enable debug logging

(...args: Array<unknown>)

Source from the content-addressed store, hash-verified

457 * Set DEBUG to true in localStorage to enable debug logging
458 */
459function debugLog(...args: Array<unknown>): void {
460 // Check if we're in a browser environment
461 const isBrowser =
462 typeof window !== `undefined` && typeof localStorage !== `undefined`
463
464 // In browser, check localStorage for debug flag
465 if (isBrowser && localStorage.getItem(`DEBUG`) === `true`) {
466 console.log(`[proxy]`, ...args)
467 }
468 // In Node.js environment, check for environment variable (though this is primarily for browser)
469 else if (
470 // true
471 !isBrowser &&
472 typeof process !== `undefined` &&
473 process.env.DEBUG === `true`
474 ) {
475 console.log(`[proxy]`, ...args)
476 }
477}
478
479// Add TypedArray interface with proper type
480interface TypedArray {

Callers 9

createChangeProxyFunction · 0.85
markChangedFunction · 0.85
checkIfRevertedFunction · 0.85
checkParentStatusFunction · 0.85
createObjectProxyFunction · 0.85
getFunction · 0.85
setFunction · 0.85
deletePropertyFunction · 0.85

Calls 1

getItemMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…