14#include "absl/strings/str_format.h"
15#include "absl/strings/str_cat.h"
17#include "absl/strings/string_view.h"
54 const std::set<std::string>& categories);
62 void log(
LogLevel level, absl::string_view category,
63 absl::string_view message);
98#define LOG(level, category, format, ...) \
100 yaze::util::LogManager::instance().log( \
101 level, category, absl::StrFormat(format, ##__VA_ARGS__)); \
104#define LOG_DEBUG(category, format, ...) \
105 LOG(yaze::util::LogLevel::YAZE_DEBUG, category, format, ##__VA_ARGS__)
106#define LOG_INFO(category, format, ...) \
107 LOG(yaze::util::LogLevel::INFO, category, format, ##__VA_ARGS__)
108#define LOG_WARN(category, format, ...) \
109 LOG(yaze::util::LogLevel::WARNING, category, format, ##__VA_ARGS__)
110#define LOG_ERROR(category, format, ...) \
111 LOG(yaze::util::LogLevel::ERROR, category, format, ##__VA_ARGS__)
112#define LOG_FATAL(category, format, ...) \
113 LOG(yaze::util::LogLevel::FATAL, category, format, ##__VA_ARGS__)
115template <
typename... Args>
116inline void logf(
const absl::FormatSpec<Args...>& format, Args&&... args) {
118 absl::StrFormat(format, std::forward<Args>(args)...));
121inline void logf(absl::string_view message) {
A singleton that manages all logging configuration and output.
std::ofstream log_stream_
static LogManager & instance()
void configure(LogLevel level, const std::string &file_path, const std::set< std::string > &categories)
Configures the logging system.
std::string log_file_path_
void DisableDebugLogging()
void operator=(const LogManager &)=delete
void EnableDebugLogging()
Toggle debug logging on/off at runtime.
LogLevel GetLogLevel() const
std::atomic< bool > all_categories_enabled_
std::atomic< LogLevel > min_level_
void SetLogLevel(LogLevel level)
Runtime log level control (for debug card)
std::set< std::string > enabled_categories_
void log(LogLevel level, absl::string_view category, absl::string_view message)
The primary logging function.
LogManager(const LogManager &)=delete
bool IsDebugEnabled() const
LogLevel
Defines the severity levels for log messages. This allows for filtering messages based on their impor...
void logf(const absl::FormatSpec< Args... > &format, Args &&... args)
Main namespace for the application.