MCPcopy Index your code
hub / github.com/huggingface/transformers.js / createLogger

Function createLogger

scripts/logger.mjs:24–39  ·  view source on GitHub ↗
(prefix = "")

Source from the content-addressed store, hash-verified

22 * @returns {Object} Logger object with various log methods
23 */
24export function createLogger(prefix = "") {
25 const formatPrefix = prefix ? `${colors.magenta}[${prefix}]${colors.reset} ` : "";
26
27 return {
28 section: (text) => console.log(`\n${formatPrefix}${colors.bright}${colors.cyan}=== ${text} ===${colors.reset}`),
29 info: (text) => console.log(`${formatPrefix}${colors.blue}[info]${colors.reset} ${text}`),
30 success: (text) => console.log(`${formatPrefix}${colors.green}✓${colors.reset} ${text}`),
31 warning: (text) => console.log(`${formatPrefix}${colors.yellow}[warn]${colors.reset} ${text}`),
32 error: (text) => console.log(`${formatPrefix}${colors.red}[error]${colors.reset} ${text}`),
33 dim: (text) => console.log(`${formatPrefix}${colors.dim}${text}${colors.reset}`),
34 url: (text) => console.log(`${formatPrefix} ${colors.cyan}→${colors.reset} ${colors.bright}${text}${colors.reset}`),
35 file: (text) => console.log(`${formatPrefix} ${colors.gray}-${colors.reset} ${text}`),
36 build: (text) => console.log(`${formatPrefix}${colors.cyan}[build]${colors.reset} ${text}`),
37 done: (text) => console.log(`${formatPrefix}${colors.green}[done]${colors.reset} ${text}`),
38 };
39}
40
41// Default logger without prefix for backward compatibility
42export const log = createLogger();

Callers 3

dev.mjsFile · 0.90
build.mjsFile · 0.90
logger.mjsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected