2#ifndef LOGIT_CPP_HEADER_LOGIT_CPP_LOGIT_LOGGERS_ILOGREADER_HPP_INCLUDED
3#define LOGIT_CPP_HEADER_LOGIT_CPP_LOGIT_LOGGERS_ILOGREADER_HPP_INCLUDED
13#if __cplusplus >= 201703L
43#if __cplusplus >= 201703L
46 enum class LogReadError {
58 struct LogReadResult {
59 std::optional<T> value;
60 LogReadError error = LogReadError::None;
83 std::size_t limit = 0)
const = 0;
85#if __cplusplus >= 201703L
87 virtual LogReadResult<std::vector<LogRecordSnapshot>> read_range_result(
90 std::size_t limit = 0)
const {
91 LogReadResult<std::vector<LogRecordSnapshot>> result;
92 result.value =
read_range(from_ms, to_ms, limit);
104 int64_t period_ms = 0,
107#if __cplusplus >= 201703L
109 virtual LogReadResult<std::vector<LogRecordSnapshot>> read_recent_result(
111 int64_t period_ms = 0,
113 LogReadResult<std::vector<LogRecordSnapshot>> result;
114 result.value =
read_recent(limit, period_ms, order);
Optional interface for backends that expose stored records.
virtual std::vector< LogRecordSnapshot > read_range(int64_t from_ms, int64_t to_ms, std::size_t limit=0) const =0
Reads records in [from_ms, to_ms) ordered by timestamp.
virtual ~ILogReader()=default
virtual std::vector< LogRecordSnapshot > read_recent(std::size_t limit, int64_t period_ms=0, LogReadOrder order=LogReadOrder::Ascending) const =0
Reads the most recent records.
Enumerations and utility functions for logging levels and text colors.
The primary namespace for the LogIt++ library.
@ LOG_LVL_TRACE
Trace level logging.
@ None
Store payload bytes as-is.
LogReadOrder
Ordering for query results returned by ILogReader.
@ Descending
Newest first.
Common owning snapshot of a stored log record.
std::string message
Formatted message or payload preview.
uint32_t sequence
Per-timestamp sequence, or 0 if unused.
int64_t timestamp_ms
Log timestamp in milliseconds.
int line
Source line number.
uint64_t session_id
Owning session id, or 0 if unused.
uint64_t payload_id
Payload row id, or 0 when absent.
std::string file
Source file path.
std::string function
Source function name.
LogLevel level
Log severity level.