@coretext-ai/qa-discord-77f3255a-cccf-4fab-b131-c7d49ae1be7c
Version:
MCP server with discord integration
104 lines • 2.58 kB
TypeScript
/**
* LogShipper - Centralized log shipping service for discord-mcp-server
* Sends logs to the centralized logging API endpoint with batching and retry logic
*/
export interface LogEntry {
timestamp: string;
level: string;
sessionId: string;
user: string;
integration: string;
component: string;
action: string;
message: string;
serverName: string;
projectId?: string;
organizationId?: string;
metadata?: {
toolParams?: any;
responseData?: any;
errorDetails?: any;
duration_ms?: number;
httpStatus?: number;
responseSize?: number;
requestId?: string;
executionId?: string;
[key: string]: any;
};
}
export interface LogBatch {
logs: LogEntry[];
}
export interface LogShipperConfig {
endpoint: string;
apiKey?: string;
requireApiKey?: boolean;
batchSize: number;
flushInterval: number;
maxRetries: number;
enabled: boolean;
}
export declare class LogShipper {
private config;
private logQueue;
private flushTimer;
private isShuttingDown;
private lastSuccessfulFlush;
constructor(config: LogShipperConfig);
private validateConfig;
private startFlushTimer;
/**
* Add a log entry to the queue
*/
addLog(logEntry: LogEntry): void;
/**
* Flush all queued logs to the endpoint
*/
flush(): Promise<void>;
/**
* Send logs with retry logic
*/
private sendLogsWithRetry;
/**
* Map component values to API-accepted enum values
*/
private mapComponentToValidEnum;
/**
* Map log level to API-accepted enum values (lowercase)
*/
private mapLogLevelToValidEnum;
/**
* Validate and clean log entries to ensure API compatibility
*/
private validateAndCleanLogs;
/**
* Clean metadata object to ensure JSON serialization compatibility
*/
private cleanMetadata;
/**
* Send logs to the API endpoint
*/
private sendLogs;
/**
* Generate a unique session ID
*/
private generateSessionId;
/**
* Log locally to stderr (for debugging the log shipper itself)
*/
private logLocally;
/**
* Get health status of the log shipper
*/
getHealthStatus(): {
healthy: boolean;
lastFlush?: string;
queueSize: number;
config: Partial<LogShipperConfig>;
};
/**
* Graceful shutdown - flush remaining logs
*/
shutdown(): Promise<void>;
}
//# sourceMappingURL=log-shipper.d.ts.map