Skip to main content
Glama
by felipfr
logger.service.ts1.98 kB
import { pino } from 'pino' import { injectable, singleton } from 'tsyringe' import { ILogger } from 'types/logger.js' /** * LoggerService - Centralized logging service using Pino * * Provides structured logging capabilities for the application with different * log levels and formatted output. Uses singleton pattern to ensure a single * logger instance across the application. * * @example * ```typescript * // In a service that needs logging * constructor(@inject(LoggerService) private logger: LoggerService) {} * * // Usage * this.logger.info('Operation completed successfully'); * this.logger.error('Failed to process request', error); * ``` */ @injectable() @singleton() export class LoggerService implements ILogger { private logger: pino.Logger constructor() { this.logger = pino({ transport: { target: 'pino-pretty', options: { colorize: true, translateTime: 'SYS:standard', ignore: 'pid,hostname' } }, level: process.env.LOG_LEVEL ?? 'info' }) } /** @inheritdoc */ public trace(message: string, obj?: object): void { this.logger.trace(obj ?? {}, message) } /** @inheritdoc */ public debug(message: string, obj?: object): void { this.logger.debug(obj ?? {}, message) } /** @inheritdoc */ public info(message: string, obj?: object): void { this.logger.info(obj ?? {}, message) } /** @inheritdoc */ public warn(message: string, obj?: object): void { this.logger.warn(obj ?? {}, message) } /** @inheritdoc */ public error(message: string, error?: unknown): void { if (error instanceof Error) { this.logger.error({ err: error }, message) } else { this.logger.error(error ?? {}, message) } } /** @inheritdoc */ public child(bindings: pino.Bindings): LoggerService { const childService = new LoggerService() childService.logger = this.logger.child(bindings) return childService } }

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/felipfr/linkedin-mcpserver'

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