1#define LOGIT_BASE_PATH "E:\\_repoz\\log-it-cpp"
13 CustomLogger() =
default;
19 std::ostringstream oss;
24 << message << std::endl;
27 std::cout << oss.str();
46 void wait()
override {
50 ~CustomLogger()
override =
default;
55 std::cout <<
"Starting logging example with custom backend..." << std::endl;
61 float someFloat = 99.99f;
64 LOGIT_INFO(
"Custom backend info log", someFloat, someInt);
65 LOGIT_WARN(
"This is a warning message from the custom logger");
66 LOGIT_ERROR(
"Custom logger error message occurred");
70 throw std::runtime_error(
"Example runtime error");
71 }
catch (
const std::exception& ex) {
78 std::cout <<
"Logging example with custom backend completed." << std::endl;
Main header file for the LogIt++ library.
#define LOGIT_WAIT()
Macro for waiting for all asynchronous loggers to finish processing.
#define LOGIT_ADD_LOGGER(logger_type, logger_args, formatter_type, formatter_args)
Macro for adding a logger with a specific formatter.
Interface for loggers that handle log message output.
virtual double get_float_param(const LoggerParam ¶m) const =0
Retrieves a floating-point parameter from the logger. Derived classes should implement this to return...
virtual int64_t get_int_param(const LoggerParam ¶m) const =0
Retrieves an integer parameter from the logger. Derived classes should implement this to return speci...
virtual void log(const LogRecord &, const std::string &)=0
Logs a message.
virtual std::string get_string_param(const LoggerParam ¶m) const =0
Retrieves a string parameter from the logger. Derived classes should implement this to return specifi...
virtual void wait()=0
Waits for all asynchronous logging operations to complete.
std::string to_string(const LogLevel &level, const int &mode=0)
Convert LogLevel to a std::string representation.
LoggerParam
Enumeration for different logger parameters that can be retrieved.
Stores log metadata and content.
const LogLevel log_level
Log level (severity).
const int64_t timestamp_ms
Timestamp in milliseconds.