UNPKG

@poai/mcpm-aider

Version:

Your MCP CLI Manager for aider(forked from @mcpm/cli). Helps you install/remove/search your MCP projects. You can also manage your MCP in Claude App with natural language.

58 lines (57 loc) 1.86 kB
import chalk from 'chalk'; export var LogLevel; (function (LogLevel) { LogLevel[LogLevel["DEBUG"] = 0] = "DEBUG"; LogLevel[LogLevel["INFO"] = 1] = "INFO"; LogLevel[LogLevel["WARN"] = 2] = "WARN"; LogLevel[LogLevel["ERROR"] = 3] = "ERROR"; })(LogLevel = LogLevel || (LogLevel = {})); class Logger { static instance; logLevel = LogLevel.INFO; constructor() { // Singleton pattern } static getInstance() { if (!Logger.instance) { Logger.instance = new Logger(); } return Logger.instance; } setLogLevel(level) { this.logLevel = level; } shouldLog(level) { return level >= this.logLevel; } formatMessage(level, message) { const timestamp = new Date().toISOString(); return `[${timestamp}] [${level}] ${message}`; } debug(message, ...args) { if (!this.shouldLog(LogLevel.DEBUG)) return; const formattedMessage = this.formatMessage('DEBUG', message); console.error(chalk.gray(formattedMessage), ...args); } info(message, ...args) { if (!this.shouldLog(LogLevel.INFO)) return; const formattedMessage = this.formatMessage('INFO', message); console.error(chalk.blue(formattedMessage), ...args); } warn(message, ...args) { if (!this.shouldLog(LogLevel.WARN)) return; const formattedMessage = this.formatMessage('WARN', message); console.error(chalk.yellow(formattedMessage), ...args); } error(message, ...args) { if (!this.shouldLog(LogLevel.ERROR)) return; const formattedMessage = this.formatMessage('ERROR', message); console.error(chalk.red(formattedMessage), ...args); } } // Export a singleton instance export const logger = Logger.getInstance();