n8n/packages/@n8n/instance-ai/evaluations/harness/logger.ts
José Braulio González Valido 2383749980
feat(ai-builder): Workflow evaluation framework with LLM mock execution (#27818)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Arvin A <51036481+DeveloperTheExplorer@users.noreply.github.com>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2026-04-07 13:31:16 +00:00

45 lines
1.0 KiB
TypeScript

// ---------------------------------------------------------------------------
// Simple evaluation logger with timestamp prefixes and verbosity control
// ---------------------------------------------------------------------------
export interface EvalLogger {
info(msg: string): void;
verbose(msg: string): void;
success(msg: string): void;
warn(msg: string): void;
error(msg: string): void;
isVerbose: boolean;
}
export function createLogger(verbose: boolean): EvalLogger {
return {
isVerbose: verbose,
info(msg: string): void {
console.log(`${timestamp()} [INFO] ${msg}`);
},
verbose(msg: string): void {
if (verbose) {
console.log(`${timestamp()} [VERBOSE] ${msg}`);
}
},
success(msg: string): void {
console.log(`${timestamp()} [OK] ${msg}`);
},
warn(msg: string): void {
console.log(`${timestamp()} [WARN] ${msg}`);
},
error(msg: string): void {
console.error(`${timestamp()} [ERROR] ${msg}`);
},
};
}
function timestamp(): string {
return new Date().toISOString();
}