@ones-open/node-host
Version:
ONES Open Platform Node.js plugin host
23 lines (22 loc) • 522 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.logs = void 0;
/* 日志池,用于暂存日志,心跳时上报给开放平台 */
class Logs {
constructor() {
this.logs = [];
}
/** 添加日志 */
add(log) {
this.logs.push(log);
}
/** 提取指定数量log */
extract(count = Infinity) {
return this.logs.splice(-count);
}
/** 清空日志 */
clear() {
this.logs.length = 0;
}
}
exports.logs = new Logs();