TConsoleCapture
Bun

type

WebView.ConsoleCapture

type ConsoleCapture = typeof console | (type: string, ...args: unknown[]) => void

Console capture. Called for each console.* invocation in the page.

  • globalThis.console: forward directly to the parent's console. console.log("hi") in the page prints hi to stdout with Bun's formatter; console.error goes to stderr. Zero JS overhead per call — dispatches through ConsoleClient directly.
  • (type, ...args) => void: custom callback. type is the method name ("log" | "warn" | "error" | "info" | "debug" | ...). Primitive args unwrap to their raw values; object args arrive as a structured descriptor — for Chrome, the CDP RemoteObject with .type/.className/.description/.preview.properties; for WebKit, the JSON round-trip of the object (lossy for functions/ circular refs, which stringify to their String(...) coercion).