Skip to main content
Glama
logger.ts1.27 kB
import { redact } from './config.js'; type Level = 'debug' | 'info' | 'warn' | 'error'; function ts() { return new Date().toISOString(); } function fmt(obj: any): string { try { return JSON.stringify(obj); } catch { return String(obj); } } export const logger = { debug(msg: string, meta?: Record<string, any>) { if (process.env.LOG_LEVEL === 'debug') { console.error(`[${ts()}] DEBUG ${msg}${meta ? ' ' + fmt(redactMeta(meta)) : ''}`); } }, info(msg: string, meta?: Record<string, any>) { console.error(`[${ts()}] INFO ${msg}${meta ? ' ' + fmt(redactMeta(meta)) : ''}`); }, warn(msg: string, meta?: Record<string, any>) { console.error(`[${ts()}] WARN ${msg}${meta ? ' ' + fmt(redactMeta(meta)) : ''}`); }, error(msg: string, meta?: Record<string, any>) { console.error(`[${ts()}] ERROR ${msg}${meta ? ' ' + fmt(redactMeta(meta)) : ''}`); }, }; function redactMeta(meta: Record<string, any>) { const out: Record<string, any> = {}; for (const [k, v] of Object.entries(meta)) { if (k.toLowerCase().includes('password') || k.toLowerCase().includes('authorization') || k.toLowerCase().includes('token')) { out[k] = redact(String(v)); } else { out[k] = v; } } return out; }

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/littlebearapps/wp-navigator-mcp'

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