UNPKG

@chargetrip/mcp

Version:

Chargetrip MCP server

27 lines (23 loc) 764 B
import winston, { Logger } from 'winston'; const levels = Object.keys(winston.config.cli.levels); const level = parseInt(process.env.LOG_LEVEL || `${levels.length - 1}`, 10); export class AppLogger { /** * @description Singleton instance of the logger. */ protected static instance: Logger = winston.createLogger({ levels: winston.config.npm.levels, level: levels[Math.min(level, levels.length - 1)], format: winston.format.json(), defaultMeta: { application: 'mcp' }, transports: [new winston.transports.Console()], }); /** * @description Get the singleton instance of the logger. * * @returns {Logger} The singleton logger instance. */ public static getInstance(): Logger { return AppLogger.instance; } }