UNPKG

@maximai/maxim-js

Version:

Maxim AI JS SDK. Visit https://getmaxim.ai for more info.

41 lines 967 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CaptureWriter = void 0; /** * A writer that captures CommitLogs instead of sending them. * Used by LogLine to generate log lines using the actual container classes. */ class CaptureWriter { constructor() { this._logs = []; this.raiseExceptions = false; } /** * Captures a commit log instead of sending it. */ commit(log) { this._logs.push(log); } /** * Returns all captured logs and clears the internal buffer. */ drain() { const logs = this._logs; this._logs = []; return logs; } /** * Returns all captured logs without clearing. */ get logs() { return [...this._logs]; } /** * Clears all captured logs. */ clear() { this._logs = []; } } exports.CaptureWriter = CaptureWriter; //# sourceMappingURL=captureWriter.js.map