After building todo-cli as my first Go project, I wanted to go deeper. The TODO manager was a great introduction to Go fundamentals, but I hadn’t touched two of the things Go is most celebrated for: concurrency and terminal UI development. So I set out to build something that would let me explore both.
The Idea
As a developer, I spend a fair amount of time staring at log files. The usual workflow — tail -f, grep, piping things together — gets the job done, but it’s not exactly pleasant. I wanted a tool that felt more like an editor than a pipeline. Something keyboard-driven, fast, and comfortable to use.
The result is logviz: a lightweight TUI log file viewer built with Bubbletea and the Charmbracelet ecosystem.
Why Bubbletea?
Bubbletea is built around the Elm architecture — a Model-Update-View pattern that keeps application state predictable and easy to reason about. If you’ve ever worked with Redux or a similar state management library, the concept will feel familiar.
The Charmbracelet ecosystem also ships Bubbles (pre-built UI components like viewports and text inputs) and Lipgloss(a styling library for the terminal). Together they make it surprisingly straightforward to build polished TUI applications.
What logviz Can Do
- Vim-style navigation —
j,k,gg,G,Ctrl+d,Ctrl+ufor vertical scrolling;h,l,0,$for horizontal scrolling - Search — press
/to search,nandNto jump between occurrences, with all matches highlighted - Filter — press
fto filter lines by keyword, narrowing down the visible output - Error navigation — press
eandEto jump directly betweenERRORlines - Jump to line — press
:followed by a line number to jump directly there - Log level highlighting —
ERROR,WARN, andDEBUGlines are colorized for quick scanning - Status bar — shows the filename, current line, and scroll percentage at all times
What I Learned
This project introduced me to a few things I hadn’t touched in my first Go project:
The Elm architecture in practice. Bubbletea forces you to think about your application as a pure function from state to UI. All events flow through a single Update function, and the UI is always a pure reflection of the current model. It takes some getting used to, but the result is surprisingly easy to maintain and extend.
Goroutines and channels without thinking about them. File loading happens asynchronously via Bubbletea’s Cmdsystem, which wraps goroutines in a clean abstraction. You define what should happen, return it as a command, and let the runtime handle the concurrency. A refreshing contrast to Java’s threading model.
Cross-compilation is effortless. Building binaries for Linux and macOS on both x86_64 and ARM64 is a single GOOSand GOARCH environment variable away. No cross-compilation toolchains, no Docker containers — just go build.
Try It
logviz is open source under the MIT license and available on Codeberg. Pre-built binaries for Linux and macOS on both x86_64 and ARM64 are available on the releases page.
# Extract and install
tar -xzf logviz--v0.3.0.tar.gz
sudo mv logviz /usr/local/bin/
# Run it
logviz /var/log/syslog
Or build it yourself:
git clone https://codeberg.org/mtnr_dev/logviz.git
cd logviz
go build -o logviz .
Happy logging!
Leave a Reply