Skip to main content
Glama
output-logger.ts2.57 kB
/** * Output Logger Module * Wrapper for console.error to avoid JSON parsing issues in MCP servers * Part of Jaxon Digital Optimizely DXP MCP Server */ /** * Output Logger Implementation * Uses console.error to avoid JSON parsing issues in MCP servers * All output goes to stderr to prevent interference with JSON-RPC protocol */ class OutputLogger { /** * Log output message (uses console.error to avoid MCP JSON parsing issues) * @param message - Message to log */ static log(message: string): void { console.error(message); } /** * Log info with ℹ️ emoji * @param message - Info message to log */ static info(message: string): void { console.error(`ℹ️ ${message}`); } /** * Log success with ✅ emoji * @param message - Success message to log */ static success(message: string): void { console.error(`✅ ${message}`); } /** * Log warning with ⚠️ emoji * @param message - Warning message to log * @note Previously named 'warning()' - use 'warn()' instead */ static warn(message: string): void { console.error(`⚠️ ${message}`); } /** * Log error with ❌ emoji * @param message - Error message to log */ static error(message: string): void { console.error(`❌ ${message}`); } /** * Log progress with 🔄 emoji * @param message - Progress message to log */ static progress(message: string): void { console.error(`🔄 ${message}`); } /** * Log deployment with 🚀 emoji * @param message - Deployment message to log */ static deploy(message: string): void { console.error(`🚀 ${message}`); } /** * Log debug information (only when DEBUG environment variable is set) * @param message - Debug message to log * @param data - Optional data to include (objects will be stringified) */ static debug(message: string, data: any = null): void { if (process.env.DEBUG) { if (data !== null) { // Handle objects/arrays by stringifying them if (typeof data === 'object') { console.error(`🔍 [DEBUG] ${message}`, JSON.stringify(data, null, 2)); } else { console.error(`🔍 [DEBUG] ${message}`, data); } } else { console.error(`🔍 [DEBUG] ${message}`); } } } } export default OutputLogger;

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/JaxonDigital/optimizely-dxp-mcp'

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