Files
SerpentRace/SerpentRace_Backend/dist/Application/Services/LoggingService.d.ts
T

57 lines
1.7 KiB
TypeScript

import { Request, Response, NextFunction } from 'express';
export declare enum LogLevel {
REQUEST = "REQUEST",
ERROR = "ERROR",
WARNING = "WARNING",
AUTH = "AUTH",
DATABASE = "DATABASE",
STARTUP = "STARTUP",
CONNECTION = "CONNECTION",
OTHER = "OTHER"
}
export interface LogEntry {
timestamp: string;
level: LogLevel;
message: string;
metadata?: any;
requestId?: string;
userId?: string;
ip?: string;
userAgent?: string;
method?: string;
url?: string;
statusCode?: number;
responseTime?: number;
}
export declare class LoggingService {
private static instance;
private minioClient;
private logBuffer;
private currentLogFile;
private logCount;
private readonly maxLogsPerFile;
private readonly logsDir;
private readonly bucketName;
private uploadInterval;
private constructor();
static getInstance(): LoggingService;
private initializeLogsDirectory;
private initializeMinioClient;
private ensureBucketExists;
private startPeriodicUpload;
private getMonthlyDirectory;
private getMonthlyMinioPrefix;
private createNewLogFile;
private formatLogEntry;
private writeToLocalFile;
private rotateLogFile;
private uploadToMinio;
private logToConsole;
log(level: LogLevel, message: string, metadata?: any, req?: Request, res?: Response, responseTime?: number): void;
private generateRequestId;
shutdown(): Promise<void>;
requestLoggingMiddleware(): (req: Request, res: Response, next: NextFunction) => void;
errorLoggingMiddleware(): (error: Error, req: Request, res: Response, next: NextFunction) => void;
}
export default LoggingService;
//# sourceMappingURL=LoggingService.d.ts.map