@skrillex1224/playwright-toolkit 3.0.11 → 3.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1196,6 +1196,19 @@ var ensureLogPath = () => {
1196
1196
  const label = runId ? `proxy-meter-${runId}-${suffix}.json` : `proxy-meter-${process.pid}-${suffix}.json`;
1197
1197
  return import_path.default.join(baseDir, label);
1198
1198
  };
1199
+ var ensureStdioLogPath = (logPath) => `${logPath}.stdio.log`;
1200
+ var writeChildOutput = (stream, output, prefix) => {
1201
+ if (!stream || !output) return;
1202
+ output.on("data", (chunk) => {
1203
+ const text = chunk?.toString?.() || String(chunk || "");
1204
+ if (!text) return;
1205
+ for (const line of text.split(/\r?\n/)) {
1206
+ if (!line) continue;
1207
+ stream.write(`[${(/* @__PURE__ */ new Date()).toISOString()}] ${prefix} ${line}
1208
+ `);
1209
+ }
1210
+ });
1211
+ };
1199
1212
  var readSnapshot = (logPath) => {
1200
1213
  if (!logPath || !(0, import_fs.existsSync)(logPath)) return null;
1201
1214
  try {
@@ -1363,6 +1376,7 @@ var startProxyMeter = (options = {}) => {
1363
1376
  observedDomainResourceTypes = /* @__PURE__ */ new Map();
1364
1377
  const port = pickFreePort();
1365
1378
  const logPath = ensureLogPath();
1379
+ const stdioLogPath = ensureStdioLogPath(logPath);
1366
1380
  const scriptPath = resolveScriptPath();
1367
1381
  const debugMode = Boolean(options.debugMode);
1368
1382
  const debugMaxEvents = Math.max(10, toSafeInt(options.debugMaxEvents) || DEFAULT_DEBUG_MAX_EVENTS);
@@ -1375,19 +1389,28 @@ var startProxyMeter = (options = {}) => {
1375
1389
  PROXY_METER_DEBUG: debugMode ? "1" : "0",
1376
1390
  PROXY_METER_DEBUG_MAX_EVENTS: String(debugMaxEvents)
1377
1391
  };
1392
+ const stdioLog = (0, import_fs.createWriteStream)(stdioLogPath, { flags: "a" });
1393
+ stdioLog.write(`[${(/* @__PURE__ */ new Date()).toISOString()}] [proxy-meter-runtime] start script=${scriptPath} port=${port} snapshot=${logPath}
1394
+ `);
1378
1395
  const child = (0, import_child_process.spawn)(process.execPath, [scriptPath], {
1379
1396
  env,
1380
- stdio: ["ignore", "ignore", "ignore"]
1397
+ stdio: ["ignore", "pipe", "pipe"]
1381
1398
  });
1382
- child.once("exit", (code) => {
1399
+ writeChildOutput(stdioLog, child.stdout, "stdout");
1400
+ writeChildOutput(stdioLog, child.stderr, "stderr");
1401
+ child.once("exit", (code, signal) => {
1402
+ stdioLog.write(`[${(/* @__PURE__ */ new Date()).toISOString()}] [proxy-meter-runtime] exit code=${code ?? ""} signal=${signal ?? ""}
1403
+ `);
1404
+ stdioLog.end();
1383
1405
  if (code && code !== 0) {
1384
- logger2.warn(`[proxy-meter] exited with code ${code}`);
1406
+ logger2.warn(`[proxy-meter] exited with code ${code}; stdio=${stdioLogPath}`);
1385
1407
  }
1386
1408
  });
1387
1409
  runtime = {
1388
1410
  proc: child,
1389
1411
  port,
1390
1412
  logPath,
1413
+ stdioLogPath,
1391
1414
  startedAt: Date.now()
1392
1415
  };
1393
1416
  registerCleanup();