woaru
Version:
Universal Project Setup Autopilot - Analyze and automatically configure development tools for ANY programming language
164 lines • 5.33 kB
TypeScript
/**
* WOARU Activity Logger for Comprehensive Action Tracking
* Provides detailed logging of all WOARU actions with timestamps, context, and metadata
*/
/**
* Structure for individual activity log entries
*/
export interface ActivityLogEntry {
timestamp: string;
action: string;
command: string;
context: {
projectPath: string;
workingDirectory: string;
user?: string;
branch?: string;
};
metadata: {
filesProcessed?: number;
duration?: number;
success: boolean;
error?: string;
outputFile?: string;
};
performance: {
startTime: number;
endTime?: number;
memoryUsage?: {
heapUsed: number;
heapTotal: number;
external: number;
};
};
}
/**
* Singleton class for managing WOARU activity logging
*/
export declare class ActivityLogger {
private static instance;
private logFile;
private activeActions;
private constructor();
private initializeAsync;
/**
* Gets the singleton instance of ActivityLogger
* @returns The ActivityLogger instance
*/
static getInstance(): ActivityLogger;
/**
* Start tracking an action with context and performance metrics
* @param action - The action being performed (e.g., 'analyze', 'review')
* @param command - The full command being executed
* @param context - Context information including project path, working directory, etc.
* @returns Unique action ID for tracking completion
*/
startAction(action: string, command: string, context: {
projectPath: string;
workingDirectory: string;
user?: string;
branch?: string;
}): Promise<string>;
/**
* Complete an action with success/error details and performance metrics
* @param actionId - The unique action ID returned from startAction
* @param metadata - Completion metadata including success status, error details, etc.
*/
completeAction(actionId: string, metadata: {
filesProcessed?: number;
success: boolean;
error?: string;
outputFile?: string;
}): Promise<void>;
/**
* Log a simple event (without start/complete cycle)
* @param action - The action being logged
* @param command - The command being executed
* @param context - Context information
* @param metadata - Event metadata including success status
*/
logEvent(action: string, command: string, context: {
projectPath: string;
workingDirectory: string;
user?: string;
branch?: string;
}, metadata: {
filesProcessed?: number;
success: boolean;
error?: string;
outputFile?: string;
}): Promise<void>;
/**
* Get recent log entries
* @param limit - Maximum number of log entries to return (default: 50)
* @returns Array of recent log entries
*/
getRecentLogs(limit?: number): Promise<string[]>;
/**
* Get logs for a specific time range
* @param startDate - Start date for filtering
* @param endDate - End date for filtering
* @returns Array of log entries within the date range
*/
getLogsByDateRange(startDate: Date, endDate: Date): Promise<string[]>;
/**
* Get logs for a specific action type
* @param actionType - The action type to filter by (e.g., 'analyze', 'review')
* @returns Array of log entries for the specified action type
*/
getLogsByAction(actionType: string): Promise<string[]>;
/**
* Get logs for a specific project
* @param projectPath - The project path to filter by
* @returns Array of log entries for the specified project
*/
getLogsByProject(projectPath: string): Promise<string[]>;
/**
* Clear all logs (dangerous operation)
* @returns Promise that resolves when logs are cleared
*/
clearLogs(): Promise<void>;
/**
* Get log file path
* @returns The absolute path to the log file
*/
getLogFilePath(): string;
/**
* Get log file size and statistics
* @returns Object containing log file statistics
*/
getLogStats(): Promise<{
fileSize: number;
totalLines: number;
oldestEntry?: string;
newestEntry?: string;
}>;
/**
* Write log entry to file (private method)
* @param entry - The log entry string to write
*/
private writeLogEntry;
/**
* Get current active actions (for monitoring purposes)
* @returns Map of active action IDs to their log entries
*/
getActiveActions(): Map<string, ActivityLogEntry>;
/**
* Format log entry for display
* @param logLine - Raw log line to format
* @returns Formatted log entry object or null if parsing fails
*/
formatLogEntry(logLine: string): {
timestamp: string;
status: string;
action: string;
details: string;
} | null;
/**
* Export logs to different formats
* @param format - Export format ('json', 'csv', 'txt')
* @param outputPath - Path where to save the exported logs
*/
exportLogs(format: 'json' | 'csv' | 'txt', outputPath: string): Promise<void>;
}
//# sourceMappingURL=ActivityLogger.d.ts.map