Spaces:
Runtime error
Runtime error
Download client/src/debug.ts from build-small-hackathon/caro5: direct link, hf CLI and curl.
- Browser
- Download file 829 Bytes
-
https://huggingface.co/spaces/build-small-hackathon/caro5/resolve/refs%2Fpr%2F1/client/src/debug.ts
- Command line
-
hf download hf://spaces/build-small-hackathon/caro5@refs/pr/1/client/src/debug.ts
-
curl -L -o debug.ts https://huggingface.co/spaces/build-small-hackathon/caro5/resolve/refs%2Fpr%2F1/client/src/debug.ts
829 Bytes
| const enabled = import.meta.env.DEV || new URLSearchParams(window.location.search).has('debug') | |
| const PAD = 18 | |
| function fmt(...args: unknown[]): string { | |
| return args.map(a => | |
| typeof a === 'object' && a !== null | |
| ? JSON.stringify(a, null, 0) | |
| : String(a) | |
| ).join(' ') | |
| } | |
| export function debug(namespace: string, ...args: unknown[]): void { | |
| if (!enabled) return | |
| const ts = performance.now().toFixed(1) | |
| console.log(`[${ts}ms] [${namespace.padEnd(PAD)}]`, ...args) | |
| } | |
| export function debugEnabled(): boolean { | |
| return enabled | |
| } | |
| export function enableDebug(): void { | |
| console.info('[debug] Add ?debug=1 to the URL to enable debug logging in this Space build.') | |
| } | |
| export function disableDebug(): void { | |
| console.info('[debug] Remove ?debug=1 from the URL to disable debug logging in this Space build.') | |
| } | |