deepsource-mcp-server
Version:
Model Context Protocol server for DeepSource
80 lines (79 loc) • 2.55 kB
TypeScript
/**
* @fileoverview Simple logging service for the application.
* This provides a centralized place for all logging functionality.
*
* Configuration:
* - LOG_LEVEL: Sets the minimum log level (DEBUG, INFO, WARN, ERROR). Defaults to DEBUG.
* - LOG_FILE: Path to the log file. If not set, no logs will be written.
*
* Note: Since MCP servers use stdout for protocol communication, logs are written
* to a file instead of stdout/stderr to avoid interference.
*/
/**
* Log levels for the application
* @enum {string}
* @public
*/
export declare enum LogLevel {
DEBUG = "DEBUG",
INFO = "INFO",
WARN = "WARN",
ERROR = "ERROR"
}
/**
* Logger service for consistent logging throughout the application
* @public
*/
export declare class Logger {
private context?;
/**
* Create a new logger instance, optionally with a context
* @param context Optional context name to identify the log source
*/
constructor(context?: string);
/**
* Log a debug message
* @param message The message to log
* @param data Optional data to include in the log
*/
debug(message: string, data?: unknown): void;
/**
* Log an info message
* @param message The message to log
* @param data Optional data to include in the log
*/
info(message: string, data?: unknown): void;
/**
* Log a warning message
* @param message The message to log
* @param data Optional data to include in the log
*/
warn(message: string, data?: unknown): void;
/**
* Log an error message with improved error formatting
* @param message The message to log
* @param error Optional error to include in the log. The error will be formatted for better readability:
* - Error objects will include name, message and stack trace
* - Objects will be stringified with proper indentation
* - Other values will be converted to strings
*/
error(message: string, error?: unknown): void;
}
/**
* Default logger instance for the application
* Pre-configured with the 'DeepSourceMCP' context for quick imports
* @const {Logger}
* @public
*/
export declare const defaultLogger: Logger;
/**
* Helper function to create a logger with a specific context
* @param context The context to use for the logger
* @returns A new logger instance with the specified context
* @public
*/
export declare function createLogger(context: string): Logger;
/**
* Default export for simpler imports
*/
export default defaultLogger;