Skip to main content
Glama
logger.ts1.01 kB
export enum LogLevel { TRACE = 0, DEBUG = 1, INFO = 2, WARN = 3, ERROR = 4, } class Logger { private level: LogLevel = LogLevel.INFO; setLevel(level: LogLevel) { this.level = level; } private log(level: LogLevel, message: string, ...args: unknown[]) { if (level >= this.level) { const timestamp = new Date().toISOString(); const levelName = LogLevel[level]; console.log(`[${timestamp}] [${levelName}] ${message}`, ...args); } } trace(message: string, ...args: unknown[]) { this.log(LogLevel.TRACE, message, ...args); } debug(message: string, ...args: unknown[]) { this.log(LogLevel.DEBUG, message, ...args); } info(message: string, ...args: unknown[]) { this.log(LogLevel.INFO, message, ...args); } warn(message: string, ...args: unknown[]) { this.log(LogLevel.WARN, message, ...args); } error(message: string, ...args: unknown[]) { this.log(LogLevel.ERROR, message, ...args); } } export const logger = new Logger();

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/xwang152-jack/wechat-official-account-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server