UNPKG

wrapture

Version:

Wrapture lets you go from a Python-trained model to deployable JavaScript with a single command. It generates TypeScript bindings and a Web/Node-compatible wrapper, using WebGPU/WASM-ready ONNX runtimes.

32 lines (26 loc) 838 B
/* eslint-disable no-console */ export type LogLevelType = 'silent' | 'error' | 'warn' | 'info' | 'debug'; let currentLevel: LogLevelType = 'info'; const levels: Record<LogLevelType, number> = { silent: 0, error: 1, warn: 2, info: 3, debug: 4 }; export const setLogLevel = (level: LogLevelType) => { currentLevel = level; }; const shouldLog = (level: LogLevelType): boolean => { return levels[level] <= levels[currentLevel]; }; export const log = { debug: (...args: unknown[]) => shouldLog('debug') && console.debug('[debug]', ...args), info: (...args: unknown[]) => shouldLog('info') && console.info('[info]', ...args), warn: (...args: unknown[]) => shouldLog('warn') && console.warn('[warn]', ...args), error: (...args: unknown[]) => shouldLog('error') && console.error('[error]', ...args) };