|
ORE Studio 0.0.4
|
Exports log records to a JSON Lines file. More...
#include <file_log_exporter.hpp>


Public Member Functions | |
| file_log_exporter (const std::filesystem::path &path) | |
| Constructs a file log exporter. | |
| void | export_record (domain::log_record record) override |
| Exports a log record as a JSON line. | |
| void | flush () override |
| Flushes the file stream. | |
| void | shutdown () override |
| Closes the file. | |
Exports log records to a JSON Lines file.
Each log record is written as a single JSON object on its own line, following the JSON Lines format (https://jsonlines.org/). This format is ideal for log shipping tools like Filebeat or Fluent Bit.
Example output:
Thread-safety: This class is thread-safe. Multiple threads can call export_record() concurrently.
|
explicit |
Constructs a file log exporter.
| path | Path to the output file. Will be created if it doesn't exist. |
| std::runtime_error | if the file cannot be opened. |
|
overridevirtual |
Exports a log record as a JSON line.
The record is immediately written to the file (no internal buffering beyond OS-level buffering).
| record | The log record to export. |
Implements log_exporter.
|
overridevirtual |
Flushes the file stream.
Implements log_exporter.
|
overridevirtual |
Closes the file.
Implements log_exporter.