mirror of
https://github.com/n8n-io/n8n.git
synced 2026-05-31 16:57:08 +02:00
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>
45 lines
1.0 KiB
TypeScript
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();
|
|
}
|