Cmdliner terms for ergonomic logging configuration
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

tty: fix progress bar rendering on narrow terminals

Root cause: terminal_width() returned 80 (fallback) instead of the
actual width because tput/COLUMNS were unreliable. An 80-char progress
line on a 71-column terminal wraps, and \r only returns to the start
of the wrapped portion — each update appears on a new line.

Fix: use ioctl TIOCGWINSZ via C stub for reliable width detection.
Also: all progress output now goes through Format.pp (no split between
Format and output_string stdout), matching CraigFe's progress library
pattern. Tests use Format.str_formatter + flush_str_formatter.

Additional fixes:
- Progress.suspend: clear bar, run function, redraw (for interleaving)
- Progress.logs_reporter: wraps Logs reporter to auto-suspend progress
- Vlog wires up logs_reporter so Log.app doesn't break the progress bar
- Progress.message/set_phase no longer render (batch until next tick)

+4 -3
+2 -1
lib/dune
··· 10 10 cmdliner 11 11 ptime 12 12 ptime.clock.os 13 - json-logs)) 13 + json-logs 14 + tty))
+2 -2
lib/vlog.ml
··· 228 228 in 229 229 Fmt_tty.setup_std_outputs (); 230 230 Logs.set_level global_level; 231 - Logs.set_reporter (Logs_fmt.reporter ()); 231 + Logs.set_reporter (Tty.Progress.logs_reporter (Logs_fmt.reporter ())); 232 232 apply_source_overrides source_overrides 233 233 234 234 type log_flags = { quiet : bool; json : bool } ··· 280 280 { Logs.report } 281 281 | None -> main_reporter 282 282 in 283 - Logs.set_reporter reporter; 283 + Logs.set_reporter (Tty.Progress.logs_reporter reporter); 284 284 (* Set global level: --log override > -q/-v flags *) 285 285 let level = 286 286 match global_override with