A singleton that manages all logging configuration and output. More...
#include <log.h>
Public Member Functions | |
LogManager (const LogManager &)=delete | |
void | operator= (const LogManager &)=delete |
void | configure (LogLevel level, const std::string &file_path, const std::set< std::string > &categories) |
Configures the logging system. | |
void | log (LogLevel level, absl::string_view category, absl::string_view message) |
The primary logging function. | |
void | SetLogLevel (LogLevel level) |
Runtime log level control (for debug card) | |
LogLevel | GetLogLevel () const |
void | EnableDebugLogging () |
Toggle debug logging on/off at runtime. | |
void | DisableDebugLogging () |
bool | IsDebugEnabled () const |
Static Public Member Functions | |
static LogManager & | instance () |
Private Member Functions | |
LogManager () | |
~LogManager () | |
Private Attributes | |
std::atomic< LogLevel > | min_level_ |
std::set< std::string > | enabled_categories_ |
std::atomic< bool > | all_categories_enabled_ |
std::ofstream | log_stream_ |
std::string | log_file_path_ |
A singleton that manages all logging configuration and output.
It is designed to be configured once at application startup, typically from command-line arguments. It supports filtering by level and category, and can direct output to stderr (default) or a specified file.
|
delete |
|
private |
Definition at line 37 of file log.cc.
References log_stream_.
|
static |
Definition at line 29 of file log.cc.
References instance().
Referenced by yaze::editor::SettingsEditor::DrawAIAgentSettings(), yaze::editor::DungeonEditorV2::DrawDebugControlsCard(), instance(), yaze::util::logf(), yaze::util::logf(), yaze::emu::Spc700::LogInstruction(), and main().
|
delete |
void yaze::util::LogManager::configure | ( | LogLevel | level, |
const std::string & | file_path, | ||
const std::set< std::string > & | categories | ||
) |
Configures the logging system.
level | The minimum log level to record. |
file_path | The path to the log file. If empty, logs to stderr. |
categories | A set of specific categories to enable. If empty, all categories are enabled. |
Definition at line 43 of file log.cc.
References all_categories_enabled_, enabled_categories_, log_file_path_, log_stream_, and min_level_.
Referenced by yaze::editor::SettingsEditor::DrawAIAgentSettings(), and main().
void yaze::util::LogManager::log | ( | LogLevel | level, |
absl::string_view | category, | ||
absl::string_view | message | ||
) |
The primary logging function.
level | The severity level of the message. |
category | The category of the message (e.g., "Graphics", "Agent"). |
message | The formatted log message. |
Definition at line 74 of file log.cc.
References all_categories_enabled_, enabled_categories_, yaze::util::FATAL, log_stream_, and min_level_.
Referenced by yaze::util::logf(), yaze::util::logf(), and yaze::emu::Spc700::LogInstruction().
|
inline |
Runtime log level control (for debug card)
Definition at line 68 of file log.h.
References min_level_.
Referenced by yaze::editor::DungeonEditorV2::DrawDebugControlsCard().
|
inline |
Definition at line 69 of file log.h.
References min_level_.
Referenced by yaze::editor::DungeonEditorV2::DrawDebugControlsCard().
|
inline |
Toggle debug logging on/off at runtime.
Definition at line 74 of file log.h.
References min_level_, and yaze::util::YAZE_DEBUG.
Referenced by yaze::editor::DungeonEditorV2::DrawDebugControlsCard().
|
inline |
Definition at line 75 of file log.h.
References yaze::util::INFO, and min_level_.
Referenced by yaze::editor::DungeonEditorV2::DrawDebugControlsCard().
|
inline |
Definition at line 76 of file log.h.
References min_level_, and yaze::util::YAZE_DEBUG.
Referenced by yaze::editor::DungeonEditorV2::DrawDebugControlsCard().
|
private |
Definition at line 83 of file log.h.
Referenced by configure(), DisableDebugLogging(), EnableDebugLogging(), GetLogLevel(), IsDebugEnabled(), log(), and SetLogLevel().
|
private |
Definition at line 84 of file log.h.
Referenced by configure(), and log().
|
private |
Definition at line 85 of file log.h.
Referenced by configure(), and log().
|
private |
Definition at line 88 of file log.h.
Referenced by configure(), log(), and ~LogManager().
|
private |
Definition at line 89 of file log.h.
Referenced by configure().