2#ifndef LOGIT_CPP_HEADER_LOGIT_CPP_LOGIT_LOGGERS_ILOGGER_HPP_INCLUDED
3#define LOGIT_CPP_HEADER_LOGIT_CPP_LOGIT_LOGGERS_ILOGGER_HPP_INCLUDED
58 virtual void log(
const LogRecord& record,
const std::string& message) = 0;
91 return std::vector<std::string>();
99 return std::vector<BufferedLogEntry>();
108 return std::vector<LogFileInfo>();
128 virtual std::vector<LogFileReadResult>
read_log_files(
const std::vector<std::string>& paths)
const {
129 std::vector<LogFileReadResult> results;
130 results.reserve(paths.size());
131 for (
size_t i = 0; i < paths.size(); ++i) {
145 result.
message =
"unsupported";
Optional buffered snapshot access returns empty results by default.
virtual double get_float_param(const LoggerParam ¶m) const =0
Retrieves a floating-point parameter from the logger.
virtual void set_log_level(LogLevel level)=0
Sets the minimal log level for this logger.
virtual int64_t get_int_param(const LoggerParam ¶m) const =0
Retrieves an integer parameter from the logger.
virtual void log(const LogRecord &record, const std::string &message)=0
Logs a message.
virtual std::string get_string_param(const LoggerParam ¶m) const =0
Retrieves a string parameter from the logger.
virtual void wait()=0
Waits for all asynchronous logging operations to complete.
virtual ~ILogger()=default
virtual void shutdown()
Stops logger-owned asynchronous resources after draining pending work.
virtual std::vector< LogFileReadResult > read_log_files(const std::vector< std::string > &paths) const
Reads several persisted log files owned by this backend.
virtual std::vector< std::string > get_buffered_strings() const
Returns buffered formatted messages in chronological order.
virtual LogClearResult clear_logs(const LogClearOptions &options=LogClearOptions())
Clears logger-owned buffered or persisted records when supported.
virtual std::vector< BufferedLogEntry > get_buffered_entries() const
Returns buffered structured entries in chronological order.
virtual std::vector< LogFileInfo > list_log_files() const
Lists persisted log files owned by this backend.
virtual LogLevel get_log_level() const =0
Gets the minimal log level for this logger.
virtual LogFileReadResult read_log_file(const std::string &path) const
Reads one persisted log file owned by this backend.
The primary namespace for the LogIt++ library.
LoggerParam
Enumeration for different logger parameters that can be retrieved.
LogClearStatus
Backend cleanup status.
Selects which data categories a logger cleanup should remove.
bool include_persistent_records
Clear primary stored log records.
bool include_payloads
Clear associated payload/blob data.
bool include_sessions
Clear session metadata when supported.
Result returned by logger cleanup operations.
std::string message
Optional diagnostic or unsupported reason.
std::size_t cleared_records
Number of primary records/files cleared when available.
LogClearStatus status
Detailed cleanup status.
bool ok
True when the backend completed cleanup.
std::string path
Full path to the file.
Result of reading a persisted log file from a file-based backend.
LogFileInfo file
Metadata for the requested file.
bool ok
Whether the read succeeded.
Stores log metadata and content.