Commit 66b4e36
authored
feat: Add in-TUI log panel to prevent log messages from breaking layout (#106)
* feat: Add in-TUI log panel to prevent log messages from breaking layout (#104)
This commit adds a dedicated log panel within the TUI interface to capture and
display tracing events (ERROR, WARN, INFO, DEBUG) without breaking the ratatui
alternate screen layout.
New files:
- src/ui/tui/log_buffer.rs: LogBuffer and LogEntry structs for in-memory storage
- src/ui/tui/log_layer.rs: TuiLogLayer implementing tracing_subscriber::Layer
- src/ui/tui/views/log_panel.rs: Log panel view component with color-coded output
Key features:
- Log buffer with configurable max entries (default 1000, BSSH_TUI_LOG_MAX_ENTRIES)
- Color-coded log levels (ERROR=red, WARN=yellow, INFO=white, DEBUG=gray)
- Toggle log panel visibility with 'l' key
- Scroll logs with j/k keys when panel is visible
- Resize panel with +/- keys (3-10 lines)
- Toggle timestamps with 't' key
- Auto-detect new log entries and trigger redraw
Modified:
- src/ui/tui/app.rs: Added log panel state fields and methods
- src/ui/tui/event.rs: Added key bindings for log panel controls
- src/ui/tui/mod.rs: Integrated log layer and panel rendering
- src/ui/tui/views/*.rs: Added render_in_area() for layout flexibility
- src/utils/logging.rs: Extracted filter creation for reuse
- tests/tui_snapshot_tests.rs: Updated assertion for new footer layout
* fix: Optimize log panel performance and add documentation
- Add upper bound validation for BSSH_TUI_LOG_MAX_ENTRIES (max: 10000)
- Reduce lock time in log_panel render by cloning entries quickly
- Add documentation comments for lock contention optimization
- Update README.md with log panel keybindings and configuration
- Update ARCHITECTURE.md with log panel architecture details
- Update manpage with log panel features and environment variable
* fix: Auto-detect TUI mode and use appropriate logging layer
- Move TUI logging logic from tui/mod.rs to utils/logging.rs
- Auto-detect TUI mode based on TTY and CI environment
- Use TuiLogLayer for TUI mode (captures logs to buffer)
- Use fmt layer for non-TUI mode (console output)
- Remove redundant init_tui_logging function from TUI module
- Use global log buffer shared between logging and TUI
Fixes issue where ERROR logs were breaking TUI display
* feat: Add log panel keybinding hints to Help modal and title bar
- Always show Log Panel section in Help modal (not just when visible)
- Add inline keybinding hints to log panel title bar (j/k:scroll +/-:resize t:time)
- Update Help modal with descriptive text for log panel controls1 parent b5bb5b9 commit 66b4e36
File tree
17 files changed
+1353
-27
lines changed- docs/man
- src
- ui/tui
- views
- utils
- tests
17 files changed
+1353
-27
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2046 | 2046 | | |
2047 | 2047 | | |
2048 | 2048 | | |
| 2049 | + | |
| 2050 | + | |
2049 | 2051 | | |
2050 | 2052 | | |
2051 | 2053 | | |
2052 | 2054 | | |
2053 | 2055 | | |
2054 | | - | |
| 2056 | + | |
| 2057 | + | |
2055 | 2058 | | |
2056 | 2059 | | |
2057 | 2060 | | |
| |||
2108 | 2111 | | |
2109 | 2112 | | |
2110 | 2113 | | |
| 2114 | + | |
| 2115 | + | |
| 2116 | + | |
| 2117 | + | |
| 2118 | + | |
| 2119 | + | |
2111 | 2120 | | |
2112 | 2121 | | |
2113 | 2122 | | |
| |||
2156 | 2165 | | |
2157 | 2166 | | |
2158 | 2167 | | |
2159 | | - | |
| 2168 | + | |
| 2169 | + | |
| 2170 | + | |
| 2171 | + | |
| 2172 | + | |
| 2173 | + | |
| 2174 | + | |
| 2175 | + | |
| 2176 | + | |
| 2177 | + | |
| 2178 | + | |
| 2179 | + | |
| 2180 | + | |
| 2181 | + | |
| 2182 | + | |
| 2183 | + | |
| 2184 | + | |
| 2185 | + | |
| 2186 | + | |
| 2187 | + | |
| 2188 | + | |
| 2189 | + | |
| 2190 | + | |
| 2191 | + | |
| 2192 | + | |
| 2193 | + | |
| 2194 | + | |
| 2195 | + | |
| 2196 | + | |
| 2197 | + | |
| 2198 | + | |
| 2199 | + | |
| 2200 | + | |
| 2201 | + | |
| 2202 | + | |
| 2203 | + | |
| 2204 | + | |
| 2205 | + | |
| 2206 | + | |
| 2207 | + | |
| 2208 | + | |
| 2209 | + | |
| 2210 | + | |
| 2211 | + | |
| 2212 | + | |
| 2213 | + | |
| 2214 | + | |
| 2215 | + | |
| 2216 | + | |
| 2217 | + | |
| 2218 | + | |
| 2219 | + | |
| 2220 | + | |
| 2221 | + | |
| 2222 | + | |
| 2223 | + | |
| 2224 | + | |
| 2225 | + | |
| 2226 | + | |
| 2227 | + | |
2160 | 2228 | | |
2161 | 2229 | | |
2162 | 2230 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
269 | 269 | | |
270 | 270 | | |
271 | 271 | | |
| 272 | + | |
272 | 273 | | |
273 | 274 | | |
274 | 275 | | |
| |||
288 | 289 | | |
289 | 290 | | |
290 | 291 | | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
291 | 298 | | |
292 | 299 | | |
293 | 300 | | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
294 | 310 | | |
295 | 311 | | |
296 | 312 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1313 | 1313 | | |
1314 | 1314 | | |
1315 | 1315 | | |
| 1316 | + | |
| 1317 | + | |
1316 | 1318 | | |
1317 | 1319 | | |
1318 | 1320 | | |
1319 | 1321 | | |
1320 | 1322 | | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
1321 | 1331 | | |
1322 | 1332 | | |
1323 | 1333 | | |
| |||
1632 | 1642 | | |
1633 | 1643 | | |
1634 | 1644 | | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
| 1654 | + | |
1635 | 1655 | | |
1636 | 1656 | | |
1637 | 1657 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
20 | 24 | | |
| 25 | + | |
21 | 26 | | |
22 | 27 | | |
23 | 28 | | |
| |||
53 | 58 | | |
54 | 59 | | |
55 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
56 | 71 | | |
57 | 72 | | |
58 | 73 | | |
59 | 74 | | |
60 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
61 | 81 | | |
62 | 82 | | |
63 | 83 | | |
| |||
67 | 87 | | |
68 | 88 | | |
69 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
70 | 95 | | |
71 | 96 | | |
72 | 97 | | |
| |||
235 | 260 | | |
236 | 261 | | |
237 | 262 | | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
238 | 318 | | |
239 | 319 | | |
240 | 320 | | |
241 | 321 | | |
242 | 322 | | |
243 | 323 | | |
| 324 | + | |
244 | 325 | | |
245 | 326 | | |
246 | 327 | | |
| |||
269 | 350 | | |
270 | 351 | | |
271 | 352 | | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
272 | 366 | | |
273 | 367 | | |
274 | 368 | | |
| |||
387 | 481 | | |
388 | 482 | | |
389 | 483 | | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
390 | 565 | | |
0 commit comments