Skip to main content
Glama
logger.ts1.21 kB
import { config } from "./config/app.config.js"; class Logger { private logLevel: string; constructor() { this.logLevel = config.server.logLevel; } private getTimestamp(): string { return new Date().toISOString(); } private shouldLog(level: string): boolean { const levels = { error: 0, warn: 1, info: 2, debug: 3, }; return ( levels[level as keyof typeof levels] <= levels[this.logLevel as keyof typeof levels] ); } error(message: string, ...args: any[]): void { if (this.shouldLog("error")) { console.error(`[${this.getTimestamp()}] ERROR: ${message}`, ...args); } } warn(message: string, ...args: any[]): void { if (this.shouldLog("warn")) { console.warn(`[${this.getTimestamp()}] WARN: ${message}`, ...args); } } info(message: string, ...args: any[]): void { if (this.shouldLog("info")) { console.error(`[${this.getTimestamp()}] INFO: ${message}`, ...args); } } debug(message: string, ...args: any[]): void { if (this.shouldLog("debug")) { console.error(`[${this.getTimestamp()}] DEBUG: ${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/Nazruden/clickup-mcp-server'

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