UNPKG

@bxshefby/b24jssdk

Version:

Bitrix24 REST API JavaScript SDK

48 lines (45 loc) • 1.05 kB
/** * @package @bxshefby/b24jssdk * @version 3.3.0 * @copyright (c) 2026 Bitrix24 * @license MIT * @see https://github.com/bx-shef/b24-js-sdk * @see https://b24-js-sdk.bx-shef.by/ */ import { LogLevel } from '../../types/logger.mjs'; import { AbstractHandler } from './abstract-handler.mjs'; var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); class MemoryHandler extends AbstractHandler { static { __name(this, "MemoryHandler"); } records = []; limit; constructor(level = LogLevel.DEBUG, options) { const opts = { bubble: true, limit: 1e3, ...options }; super(level, opts.bubble); this.limit = opts.limit; } /** * @inheritDoc */ async handle(record) { this.records.push(record); if (this.records.length > this.limit) { this.records.shift(); } return true; } getRecords() { return [...this.records]; } clear() { this.records = []; } } export { MemoryHandler };