UNPKG

@presidio-dev/factifai-agent

Version:

An AI powered browser automation testing agent powered by LLMs.

129 lines 3.53 kB
import ora from "ora"; import { Options as BoxenOptions } from "boxen"; /** * Logger configuration options */ export interface LoggerConfig { logToFile: boolean; logFilePath: string; logLevel: "debug" | "info" | "warn" | "error"; useColors: boolean; showTimestamp: boolean; timestampFormat: "iso" | "locale" | "relative" | "time12"; logPrefix?: string; sessionId?: string; } type SpinnerInstance = ReturnType<typeof ora>; interface SpinnerRegistry { [key: string]: SpinnerInstance; } /** * Enhanced logger implementation with pretty formatting and interactive elements */ export declare const logger: { config: { logToFile: boolean; logFilePath: string; logLevel: "debug" | "info" | "warn" | "error"; useColors: boolean; showTimestamp: boolean; timestampFormat: "iso" | "locale" | "relative" | "time12"; logPrefix?: string; sessionId?: string; }; spinners: SpinnerRegistry; /** * Configure the logger */ configure(config: Partial<LoggerConfig>): void; /** * Set the session ID and update log file path * This method should be called when a new test session starts */ setSessionId(sessionId: string): void; /** * Ensure the log directory exists */ ensureLogDirectory(): boolean; /** * Write a message to the log file */ appendToFile(message: string): void; /** * Format a log entry with timestamp and metadata */ formatLogEntry(level: string, message: string, args: any[]): string; /** * Format a log entry with timestamp and metadata with colors */ formatColorizedLogEntry(level: string, message: string, args: any[]): { metaInfo: string; mainContent: string; }; /** * Format and colorize log level */ formatLevel(level: string): string; /** * Check if the given log level should be displayed */ shouldLog(level: string): boolean; /** * Log an info message */ info(message: string, ...args: any[]): void; /** * Log a success message */ success(message: string, ...args: any[]): void; /** * Log an error message */ error(message: string, ...args: any[]): void; /** * Log a warning message */ warn(message: string, ...args: any[]): void; /** * Log a debug message */ debug(message: string, ...args: any[]): void; /** * Create a boxed message */ box(message: string, options?: BoxenOptions): void; /** * Create a table from data */ table(data: any[][], options?: any): void; /** * Create and start a spinner */ spinner(text: string, id?: string): SpinnerInstance; /** * Update an existing spinner */ updateSpinner(id: string, text: string): SpinnerInstance | null; /** * Stop a spinner with success */ spinnerSuccess(id: string, text?: string): void; /** * Stop a spinner with error */ spinnerError(id: string, text?: string): void; /** * Format file size in a human-readable way */ formatBytes(bytes: number): string; /** * Format duration in a human-readable way */ formatDuration(milliseconds: number): string; /** * Log the start of a task and return a function to log its completion with elapsed time */ task(taskName: string): () => void; }; export {}; //# sourceMappingURL=logger.d.ts.map