10#include "absl/strings/str_cat.h"
11#include "absl/strings/str_format.h"
12#include "absl/strings/string_view.h"
50 const std::set<std::string>& categories);
58 void log(
LogLevel level, absl::string_view category,
59 absl::string_view message);
97#define LOG(level, category, format, ...) \
99 yaze::util::LogManager::instance().log( \
100 level, category, absl::StrFormat(format, ##__VA_ARGS__)); \
103#define LOG_DEBUG(category, format, ...) \
104 LOG(yaze::util::LogLevel::YAZE_DEBUG, category, format, ##__VA_ARGS__)
105#define LOG_INFO(category, format, ...) \
106 LOG(yaze::util::LogLevel::INFO, category, format, ##__VA_ARGS__)
107#define LOG_WARN(category, format, ...) \
108 LOG(yaze::util::LogLevel::WARNING, category, format, ##__VA_ARGS__)
109#define LOG_ERROR(category, format, ...) \
110 LOG(yaze::util::LogLevel::ERROR, category, format, ##__VA_ARGS__)
111#define LOG_FATAL(category, format, ...) \
112 LOG(yaze::util::LogLevel::FATAL, category, format, ##__VA_ARGS__)
114template <
typename... Args>
115inline 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_
std::set< std::string > disabled_categories_
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)