Interface: TestRunLogger<T>

Defined in: src/lib/models/testRun.ts:35

Logger interface for capturing test run execution events and progress.

Provides methods for logging informational messages, errors, and processing events during test run execution. Users can implement custom loggers to integrate with their logging infrastructure or customize output formatting.

Examples

import { TestRunLogger } from '@maximai/maxim-js';

const customLogger: TestRunLogger = {
  info: (message) => console.log(`[INFO] ${message}`),
  error: (message) => console.error(`[ERROR] ${message}`),
  processed: (message) => console.log(`[PROCESSED] ${message}`),
};
// Using custom logger with test run
maxim.createTestRun("my-test", "workspace-id")
  .withLogger(customLogger)
  .withData(testData)
  .run();

Type Parameters

T

T extends DataStructure | undefined = undefined

The data structure type for the test run TestRunLogger

Properties

error()

error: (message) => void

Defined in: src/lib/models/testRun.ts:58

Logs error messages when issues occur during test run execution.

Parameters

message

string

The error message to log

Returns

void

void

Example

// Called automatically when errors occur
logger.error("Failed to evaluate entry 42: timeout");
logger.error("API rate limit exceeded, retrying...");

info()

info: (message) => void

Defined in: src/lib/models/testRun.ts:46

Logs informational messages during test run execution.

Parameters

message

string

The informational message to log

Returns

void

void

Example

// Called automatically during test run
logger.info("Starting test run with 100 entries");
logger.info("Test run completed successfully");

processed()

processed: (message, data) => void

Defined in: src/lib/models/testRun.ts:83

Logs processing completion for individual test run entries.

Called after each dataset entry has been processed, including output generation and evaluation. Provides detailed information about the processing results for monitoring and debugging.

Parameters

message

string

The processing completion message

data

Detailed processing data

datasetEntry

Data<T>

The dataset entry that was processed

evaluationResults?

LocalEvaluationResult[]

Evaluation results (if any)

output?

YieldedOutput

The generated output (if successful)

Returns

void

void

Example

// Called automatically after each entry
logger.processed("Entry 1 processed successfully", {
  datasetEntry: { input: "Hello", expectedOutput: "Hi there!" },
  output: { data: "Hi there!" },
  evaluationResults: [
    { name: "accuracy", result: { score: 0.95, reasoning: "Excellent match" } }
  ]
});