Urgent.News

What's breaking now, across thousands of outlets.

Tech

I created an interactive TUI log debugger in Python because grep and tail are driving me crazy.

Every time something goes wrong in production, the ritual is the same: you connect to the server, open the logs, and stumble upon a huge wall of text. You strain your eyes, trying to spot the single line with the ERROR hidden among the megabytes of INFORMATION and DEBUG DATA. Of course, we have grep, tail -f. But when a giant multi‑line trace appears in the console, reading it in a standard…

Creating an interactive TUI log debugger in Python became necessary for the author, as tools like grep and tail were becoming increasingly frustrating. The daily routine involved connecting to servers, opening large log files and struggling to locate the single line with an error among vast amounts of information and debugging data. While tools like grep and tail -f existed, reading multi-line traces within a standard terminal proved to be a daunting task.

The logs were generated by either standard logging libraries or the modern loguru. When dealing with multiple services or workers, the author had to juggle between opening numerous tabs in the terminal or writing complex bash scripts. Switching between frequent errors and deep traces often involved endless scrolling of the terminal window.

TraceTUI was created using the Textual framework, dividing it into three logical panels: the left panel for a list of active log files, the central panel showcasing the log stream with automatic color coding for severity levels and the right panel displaying the full trace, metadata, and custom tags. The terminal's hassle with text wrapping was eliminated.

Key features included format autodetection for loguru, standard logging or plain text; smart error navigation using E to jump straight to errors after highlighting them in bright red; real-time filtering by pressing F and entering a search query which dynamically updated the log stream; and a timeline merging mode merging multiple log files into a single chronological timeline with source tags.

To try out TraceTUI, the project is open-source under the MIT license. Installation can be done via pip: pip install tracetui. Running it requires passing log files as arguments: tracetui app_loguru.log server.log.

The author hopes this utility will provide relief from debugging headaches in the future. The project is still in its early stages, and the author welcomes feedback, suggestions on what's missing or what can be improved. Comments and issues on GitHub are encouraged.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

A read-only MCP server for TeamCity

Most build questions arrive the same way: someone sends a link to a red build and asks what broke. Answering it by hand means opening the build, scrolling a log that can run to tens of thousands of…

More from Monday 9 November →