UNPKG

smart-ast-analyzer

Version:

Advanced AST-based project analysis tool with deep complexity analysis, security scanning, and optional AI enhancement

53 lines (45 loc) • 1.08 kB
const chalk = require('chalk'); const ora = require('ora'); class Logger { constructor(verbose = false) { this.verbose = verbose; this.spinner = null; } start(message) { console.log(chalk.cyan.bold(`\nšŸš€ ${message}\n`)); } info(message) { if (this.spinner) this.spinner.stop(); this.spinner = ora(message).start(); } success(message) { if (this.spinner) { this.spinner.succeed(message); this.spinner = null; } else { console.log(chalk.green(`āœ… ${message}`)); } } error(message, error) { if (this.spinner) { this.spinner.fail(message); this.spinner = null; } else { console.log(chalk.red(`āŒ ${message}`)); } if (error && this.verbose) { console.error(error); } } warn(message) { if (this.spinner) this.spinner.stop(); console.log(chalk.yellow(`āš ļø ${message}`)); if (this.spinner) this.spinner.start(); } debug(message) { if (this.verbose) { console.log(chalk.gray(`[DEBUG] ${message}`)); } } } module.exports = Logger;