(prefix = "")
| 22 | * @returns {Object} Logger object with various log methods |
| 23 | */ |
| 24 | export 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 |
| 42 | export const log = createLogger(); |
no outgoing calls
no test coverage detected