A real-time log viewer built with Qt 6 and C++17.
- Real-time tailing via
QFileSystemWatcher— updates as the file grows - Auto-detect structured vs plain text log lines
- Level filtering — toggle DEBUG / INFO / WARN / ERROR / FATAL independently
- Text search — live filter across all messages
- Color-coded rows per log level
- Auto-scroll toggle
- Log rotation handling — detects when a file is truncated/replaced
- Dark theme via Fusion style + custom palette
The parser recognizes lines matching:
[LEVEL] HH:mm:ss - message
[LEVEL] yyyy-MM-dd HH:mm:ss - message
Examples:
[INFO] 12:00:01 - Server started on port 8080
[WARN] 12:00:05 - High memory usage detected
[ERROR] 12:00:09 - Failed to connect to database
[DEBUG] 12:00:10 - Packet received: 42 bytes
[FATAL] 12:00:11 - Unhandled exception, shutting down
Any line that doesn't match is treated as plain text and shown with level PLAIN.
- Qt 6.x (Core, Widgets)
- CMake 3.16+
- C++17 compiler
cmake -S . -B build
cmake --build build
./build/LogViewer| File | Responsibility |
|---|---|
LogEntry.h |
Plain data struct — level, timestamp, message, raw line |
LogParser |
Stateless parser — structured regex + plain text fallback |
LogWatcher |
QFileSystemWatcher wrapper — emits newLines signal |
LogModel |
QAbstractTableModel — owns log entries, drives the view |
LogFilterProxyModel |
QSortFilterProxyModel — level + text filtering |
MainWindow |
Top-level UI — toolbar, table, status bar, dark theme |