@agility/cli
Version:
Agility CLI for working with your content. (Public Beta)
146 lines (145 loc) • 3.58 kB
TypeScript
import { fileOperations } from '../../../core/fileOperations';
export interface FileLoggerConfig {
rootPath: string;
guid: string;
locale: string;
preview: boolean;
operationType: 'pull' | 'push' | 'sync';
}
export interface LogEntry {
timestamp: string;
level: 'INFO' | 'ERROR' | 'WARNING' | 'SUCCESS';
message: string;
context?: string;
}
export declare class FileLogger {
private fileOps;
private config;
private logEntries;
constructor(config: FileLoggerConfig);
/**
* Create FileLogger from current state
*/
static fromState(operationType: 'pull' | 'push' | 'sync', guid?: string): FileLogger;
/**
* Log a message with specific level
*/
log(level: LogEntry['level'], message: string, context?: string): void;
/**
* Format log entry for file output
*/
private formatLogEntry;
/**
* Log info message
*/
logInfo(message: string, context?: string): void;
/**
* Log error message
*/
logError(message: string, context?: string): void;
/**
* Log warning message
*/
logWarning(message: string, context?: string): void;
/**
* Log success message
*/
logSuccess(message: string, context?: string): void;
/**
* Log step start
*/
logStepStart(stepName: string, details?: string): void;
/**
* Log step completion
*/
logStepComplete(stepName: string, details?: string): void;
/**
* Log step error
*/
logStepError(stepName: string, error: string): void;
/**
* Log progress update
*/
logProgress(stepName: string, progress: {
current: number;
total: number;
details?: string;
}): void;
/**
* Log download statistics
*/
logDownloadStats(stepName: string, stats: {
total: number;
successful: number;
failed: number;
skipped: number;
duration?: number;
}): void;
/**
* Log upload statistics
*/
logUploadStats(stepName: string, stats: {
total: number;
successful: number;
failed: number;
skipped: number;
duration?: number;
}): void;
/**
* Log summary information
*/
logSummary(operation: string, summary: {
startTime: Date;
endTime: Date;
totalSteps: number;
successfulSteps: number;
failedSteps: number;
entityCounts?: Record<string, number>;
}): void;
/**
* Log API operation
*/
logApiOperation(operation: string, details: {
method: string;
endpoint?: string;
success: boolean;
duration?: number;
error?: string;
}): void;
/**
* Log configuration details
*/
logConfig(config: Record<string, any>): void;
/**
* Log system information
*/
logSystemInfo(): void;
/**
* Get all log entries
*/
getLogEntries(): LogEntry[];
/**
* Get log entries by level
*/
getLogEntriesByLevel(level: LogEntry['level']): LogEntry[];
/**
* Get log entries by context
*/
getLogEntriesByContext(context: string): LogEntry[];
/**
* Get log statistics
*/
getLogStats(): Record<LogEntry['level'], number>;
/**
* Clear log entries (keeps file contents)
*/
clearLogEntries(): void;
/**
* Finalize log file and return path
*/
finalize(): string;
/**
* Get underlying fileOperations instance
*/
getFileOps(): fileOperations;
}