feat(client): truncate long logs in the client rather than test evaluator (#60235)

This commit is contained in:
Oliver Eyton-Williams
2025-05-14 22:16:31 +02:00
committed by GitHub
parent b629884fea
commit f606e19a1a
6 changed files with 18 additions and 28 deletions

View File

@@ -8,19 +8,14 @@ const ctx: Worker & typeof globalThis = self as unknown as Worker &
const __utils = (() => {
const MAX_LOGS_SIZE = 64 * 1024;
const TRUNCATE_AT = 500_000;
let logs: string[] = [];
function flushLogs() {
if (logs.length) {
let data = logs.join('\n');
if (data.length > TRUNCATE_AT) {
data = `${data.substring(0, TRUNCATE_AT)} Logs truncated. See browser console for more`;
}
ctx.postMessage({
type: 'LOG',
data: data
data: logs.join('\n')
});
logs = [];
}