dumpNativeLog method

void dumpNativeLog()

Reads back the native log file (set by stream_proxy_redirect_stderr) and pipes its contents through debugPrint in 800-char chunks. Surfaces absl/glog output (model load timing, accelerator init, sampler dlopen, KV-cache prefill, etc.) that's redirected to a file by stream_proxy_redirect_stderr and wouldn't otherwise reach the Flutter console / test harness.

Called automatically after every successful and failed engine_create (debug builds only) so timing breakdowns are visible in flutter run. Also exposed publicly via dumpNativeLog for callers that want to dump at arbitrary points (e.g. after prefill, after a slow generate).

Truncates the log file after reading so subsequent dumps only show new output — otherwise every dump would re-print everything since app start.

Implementation

void dumpNativeLog() => _dumpNativeLog();