decord/alpha/source/modules/debug/LogAggregator.tsx

101 lines
2.8 KiB
TypeScript
Raw Normal View History

2026-07-29 08:29:29 +00:00
// Module ID: 7
// Function ID: 8
// Name: LogAggregator
2026-07-29 08:29:29 +00:00
// Dependencies: [8, 2]
2026-07-20 16:05:17 +00:00
// Exports: clear, getAllForDebugPanel, report, stringify
// Module 7 (LogAggregator)
2026-08-24 06:08:38 +00:00
import DequeDefault from "Deque" /* 8 */;
let closure_0 = new DequeDefault(5000);
const size = fn(2);
const result = size.fileFinishedImporting("modules/debug/LogAggregator.tsx");
2026-07-20 16:05:17 +00:00
export const report = function report(category) {
2026-07-20 16:05:17 +00:00
let length;
2026-07-29 08:29:29 +00:00
const tmp = (function stringifyMessage(arg0) {
let str = "";
const iter = arg0[Symbol.iterator]();
const nextResult = iter.next();
for (; iter !== undefined; str = str + (error + " ")) {
error = nextResult;
let tmp2 = typeof nextResult;
2026-08-04 21:03:28 +00:00
if (typeof nextResult !== "string") {
2026-07-20 16:05:17 +00:00
if ("number" !== tmp2) {
if ("boolean" !== tmp2) {
let _Error = Error;
2026-07-29 08:29:29 +00:00
if (error instanceof Error) {
let _HermesInternal = HermesInternal;
str = `` + error.message + "\n" + error.stack + " ";
2026-07-20 16:05:17 +00:00
} else {
let _JSON = JSON;
2026-07-29 08:29:29 +00:00
str = str + (JSON.stringify(error) + " ");
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
continue;
2026-07-20 16:05:17 +00:00
}
}
}
2026-07-29 08:29:29 +00:00
return str;
})(HermesBuiltin.copyRestArgs());
if (typeof category === "string") {
const obj = { time: null, category: null, message: null };
2026-07-20 16:05:17 +00:00
const _Date = Date;
obj.time = Date.now();
obj.category = category;
obj.message = tmp;
closure_0.push(obj);
let arr = closure_0;
2026-07-29 08:29:29 +00:00
} else {
arr = closure_0;
const obj3 = { time: null, category: null, timing: null, message: null };
2026-07-29 08:29:29 +00:00
const _Date2 = Date;
obj3.time = Date.now();
({ name: obj2.category, timing: obj2.timing } = category);
obj3.message = tmp;
closure_0.push(obj3);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (arr.length > 5000) {
2026-07-20 16:05:17 +00:00
do {
let arr6 = closure_0.shift();
length = closure_0.length;
2026-07-20 16:05:17 +00:00
} while (length > 5000);
}
};
export const clear = function clear() {
closure_0.clear();
2026-07-20 16:05:17 +00:00
};
export const stringify = function stringify(arg0) {
closure_0 = arg0;
const found = closure_0.toArray().filter((category) => {
2026-07-23 10:11:24 +00:00
let hasItem = null == closure_0;
2026-07-20 16:05:17 +00:00
if (!hasItem) {
2026-07-23 10:11:24 +00:00
hasItem = closure_0.includes(category.category);
2026-07-20 16:05:17 +00:00
}
return hasItem;
});
const mapped = found.map((time) => {
const items = [];
items.push(new Date(time.time).toISOString());
if (null != time.timing) {
items.push(time.timing);
}
items.push(time.category, time.message);
return items.join(" -> ");
});
return mapped.join("\n");
};
export const getAllForDebugPanel = function getAllForDebugPanel(arg0) {
let flag = arg0;
if (arg0 === undefined) {
flag = false;
}
const toArrayResult = closure_0.toArray();
2026-07-20 16:05:17 +00:00
if (flag) {
let reversed = toArrayResult.reverse();
} else {
reversed = toArrayResult;
}
return reversed;
};