Skip to main content
Glama
logger.ts1.16 kB
import winston from 'winston'; import path from 'path'; import { fileURLToPath } from 'url'; import fs from 'fs'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const logsDir = path.join(__dirname, '..', 'logs'); if (!fs.existsSync(logsDir)) { fs.mkdirSync(logsDir); } const logger = winston.createLogger({ level: process.env.LOG_LEVEL || 'info', format: winston.format.combine( winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss', }), winston.format.printf(({ level, message, timestamp }) => { return `${timestamp} ${level.toUpperCase()}: ${message}`; }) ), transports: [ new winston.transports.File({ filename: path.join(logsDir, 'error.log'), level: 'error', }), new winston.transports.File({ filename: path.join(logsDir, 'mcp-server.log'), }), ], }); export const enableConsoleLogging = (): void => { logger.add( new winston.transports.Console({ format: winston.format.combine(winston.format.colorize(), winston.format.simple()), silent: process.env.SILENT === 'true' || process.env.SILENT === '1', }) ); }; export default 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/Softeria/ms-365-mcp-server'

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