libghostty: add log callback configuration (#12227)
In C ABI builds, the Zig std.log default writes to stderr which is not appropriate for a library. Override std_options.logFn with a custom sink that dispatches to an embedder-provided callback, or silently discards when none is registered. Add GHOSTTY_SYS_OPT_LOG to ghostty_sys_set() following the existing decode_png pattern. The callback receives the log level as a GhosttySysLogLevel enum, scope and message as separate byte slices, giving embedders full control over formatting and routing. Export ghostty_sys_log_stderr as a built-in convenience callback that writes to stderr using std.debug.lockStderrWriter for thread-safe output. Embedders who want the old behavior can install it at startup with a single ghostty_sys_set call.
M
Mitchell Hashimoto committed
c34901dddbc36b63f33bbb1a47d62f6911584d65
Committed by GitHub <noreply@github.com>
on 4/10/2026, 6:03:18 PM