first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import pc from 'picocolors';
|
||||
|
||||
/**
|
||||
* Simple evaluation logger with verbose mode support.
|
||||
*
|
||||
* Usage:
|
||||
* const log = createLogger(isVerbose);
|
||||
* log.info('Always shown');
|
||||
* log.verbose('Only shown in verbose mode');
|
||||
*/
|
||||
|
||||
export interface EvalLogger {
|
||||
/** Always shown - important info */
|
||||
info: (message: string) => void;
|
||||
/** Only shown in verbose mode - debug details */
|
||||
verbose: (message: string) => void;
|
||||
/** Success messages (green) */
|
||||
success: (message: string) => void;
|
||||
/** Warning messages (yellow) */
|
||||
warn: (message: string) => void;
|
||||
/** Error messages (red) */
|
||||
error: (message: string) => void;
|
||||
/** Dimmed text for secondary info */
|
||||
dim: (message: string) => void;
|
||||
/** Check if verbose mode is enabled */
|
||||
isVerbose: boolean;
|
||||
}
|
||||
|
||||
export function createLogger(verbose: boolean = false): EvalLogger {
|
||||
return {
|
||||
isVerbose: verbose,
|
||||
// Keep info plain so lifecycle can apply its own formatting without double-coloring.
|
||||
info: (message: string) => console.log(message),
|
||||
verbose: (message: string) => {
|
||||
if (verbose) console.log(pc.dim(message));
|
||||
},
|
||||
success: (message: string) => console.log(pc.green(message)),
|
||||
warn: (message: string) => console.warn(pc.yellow(message)),
|
||||
error: (message: string) => console.error(pc.red(message)),
|
||||
dim: (message: string) => console.log(pc.dim(message)),
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user