|
LogViewer
A modern log viewer with AI-assisted analysis (Qt 6)
|
#include <FileTailer.hpp>


Classes | |
| struct | TailObserver |
Signals | |
| void | NewEventsAvailable (std::size_t count) |
| Emitted on the main thread after new events have been added. | |
| void | TailingError (const QString &message) |
| Emitted when a tailing read or parse error occurs. | |
Public Member Functions | |
| FileTailer (QObject *parent=nullptr) | |
| ~FileTailer () override=default | |
| void | Start (const std::filesystem::path &path, std::unique_ptr< parser::IDataParser > parser, db::EventsContainer &events) |
| void | Stop () |
| bool | IsActive () const |
| const std::filesystem::path & | FilePath () const |
Private Slots | |
| void | OnFileChanged (const QString &path) |
Private Attributes | |
| QFileSystemWatcher | m_watcher |
| std::unique_ptr< parser::IDataParser > | m_parser |
| std::unique_ptr< TailObserver > | m_observer |
| db::EventsContainer * | m_events {nullptr} |
| std::filesystem::path | m_path |
| uintmax_t | m_lastOffset {0} |
| bool | m_active {false} |
| bool | m_lineBased {true} |
Watches a log file for new content and incrementally parses appended bytes.
After construction call Start(); the tailer attaches a QFileSystemWatcher to the given path. Each time the file grows the new bytes are extracted and fed to the parser's ParseData(istream&) overload. The supplied EventsContainer receives the new events via the parser's observer mechanism.
Supported formats (line- or record-based parsers that accept a partial stream starting mid-file): NDJSON/JSONL, CAN/ASC, AUTOSAR DLT
Unsupported formats: JSON array (whole-document), XML (stateful), CSV (header in first line). For these formats Start() will emit TailingError.
The parser instance is owned externally and must outlive FileTailer.
|
explicit |

|
overridedefault |
|
inline |
|
inline |
|
signal |
Emitted on the main thread after new events have been added.

|
privateslot |


| void ui::qt::FileTailer::Start | ( | const std::filesystem::path & | path, |
| std::unique_ptr< parser::IDataParser > | parser, | ||
| db::EventsContainer & | events | ||
| ) |
Begin watching path, parsing new bytes with parser into events. Emits TailingError immediately if the format is known-unsupported.

| void ui::qt::FileTailer::Stop | ( | ) |


|
signal |
Emitted when a tailing read or parse error occurs.

|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |