Utilities (upcoming)

Available in version 1.1.72 (not yet live).

Add delays and write logs.

API zw.delay(), zw.log(), zw.logTemp()

await zw.log("Starting run");
await zw.delay({ min: 1500, max: 2500 }); // randomized delay 1.5–2.5s

At a Glance

  • async await zw.delay({ min: number, max?: number }) β†’ pauses for min (ms). If max (ms) is provided and max > min, the delay is randomized between min and max.

  • async/sync* await zw.log(...values: any) β†’ like console.log, logs comma-separated values.

  • async/sync* await zw.log({ message: any, status?: "success" | "fail" | "warning", tag?: string }) β†’ logs with custom styling.

  • async/sync* await zw.logTemp(...values: any) await zw.logTemp({ message, status?: "success" | "fail" | "warning", tag?: string }) β†’ same as zw.log() but not persisted to Run Reports.

*async in browser, sync locally (see Local vs. Browser Execution).


Examples

Structured status logs (styled in the UI)

await zw.log({ message: "Logged in", status: "success", tag: "auth" });
await zw.log({ message: "Slow response detected", status: "warning", tag: "network" });
await zw.log({ message: "Failed to submit form", status: "fail", tag: "checkout" });

Log objects, arrays, and functions β€” no manual stringify needed

Exact wait with only min

Dynamic backoff based on state

Live-only logging of secrets (never persisted to Run Reports)

Try/catch with styled fail log


Notes

  • Size limits. The persistent message saved to Run Reports is capped at ~500 characters. The running log view shows up to ~500,000 characters per message. Longer inputs do not throw an error but are truncated.

  • Delay always requires await. zw.delay() is async and must be awaited in both local and browser execution.

  • Log async behavior. In the browser, zw.log() and zw.logTemp() are async β€” use await. When Write JS code runs locally, await is optional (the examples use await for consistency).

Last updated

Was this helpful?