Vulkan Schnee 0.0.1
High-performance rendering engine
Loading...
Searching...
No Matches
EngineCore::LogCategoryManager Class Reference

Global registry for log categories with runtime verbosity control. More...

#include <LogCategory.h>

Collaboration diagram for EngineCore::LogCategoryManager:

Public Member Functions

void registerCategory (LogCategory *category)
 Register a category (called automatically by DEFINE_LOG_CATEGORY)
LogCategoryfindCategory (const std::string &name)
 Find a category by name.
bool setVerbosity (const std::string &categoryName, LogVerbosity verbosity)
void setAllVerbosity (LogVerbosity verbosity)
 Set verbosity for all categories.
std::vector< LogCategory * > getAllCategories () const
 Get all registered categories (for debug UI, listing, etc.)
bool loadConfig (const std::string &configPath)
 Load verbosity settings from a JSON config file.
bool saveConfig (const std::string &configPath) const
 Save current verbosity settings to a JSON config file.

Static Public Member Functions

static LogCategoryManagerget ()
 Get the singleton instance.

Private Member Functions

 LogCategoryManager ()=default
 ~LogCategoryManager ()=default
 LogCategoryManager (const LogCategoryManager &)=delete
LogCategoryManageroperator= (const LogCategoryManager &)=delete

Private Attributes

std::mutex mutex_
std::unordered_map< std::string, LogCategory * > categories_
LogVerbosity defaultVerbosity_ = LogVerbosity::Info

Detailed Description

Global registry for log categories with runtime verbosity control.

Thread-safe singleton that manages all log categories.

Definition at line 132 of file LogCategory.h.

Constructor & Destructor Documentation

◆ LogCategoryManager() [1/2]

EngineCore::LogCategoryManager::LogCategoryManager ( )
privatedefault

Referenced by get(), LogCategoryManager(), and operator=().

Here is the caller graph for this function:

◆ ~LogCategoryManager()

EngineCore::LogCategoryManager::~LogCategoryManager ( )
privatedefault

◆ LogCategoryManager() [2/2]

EngineCore::LogCategoryManager::LogCategoryManager ( const LogCategoryManager & )
privatedelete

References LogCategoryManager().

Here is the call graph for this function:

Member Function Documentation

◆ findCategory()

LogCategory * EngineCore::LogCategoryManager::findCategory ( const std::string & name)
nodiscard

Find a category by name.

Definition at line 69 of file LogCategory.cpp.

References categories_, and mutex_.

◆ get()

LogCategoryManager & EngineCore::LogCategoryManager::get ( )
static

Get the singleton instance.

Definition at line 57 of file LogCategory.cpp.

References LogCategoryManager().

Referenced by EngineCore::LogCategory::LogCategory().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAllCategories()

std::vector< LogCategory * > EngineCore::LogCategoryManager::getAllCategories ( ) const
nodiscard

Get all registered categories (for debug UI, listing, etc.)

Definition at line 96 of file LogCategory.cpp.

References categories_, and mutex_.

◆ loadConfig()

bool EngineCore::LogCategoryManager::loadConfig ( const std::string & configPath)

Load verbosity settings from a JSON config file.

Expected format: { "LogCategories": { "LogLOD": "Verbose", "LogRenderer": "Info", "Default": "Warning" } }

Parameters
configPathPath to the JSON config file
Returns
true if config was loaded successfully

Definition at line 107 of file LogCategory.cpp.

References categories_, defaultVerbosity_, mutex_, and EngineCore::verbosityFromString().

Here is the call graph for this function:

◆ operator=()

LogCategoryManager & EngineCore::LogCategoryManager::operator= ( const LogCategoryManager & )
privatedelete

References LogCategoryManager().

Here is the call graph for this function:

◆ registerCategory()

void EngineCore::LogCategoryManager::registerCategory ( LogCategory * category)

Register a category (called automatically by DEFINE_LOG_CATEGORY)

Definition at line 63 of file LogCategory.cpp.

References categories_, EngineCore::LogCategory::getName(), and mutex_.

Referenced by EngineCore::LogCategory::LogCategory().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveConfig()

bool EngineCore::LogCategoryManager::saveConfig ( const std::string & configPath) const

Save current verbosity settings to a JSON config file.

Parameters
configPathPath to save the config
Returns
true if saved successfully

Definition at line 156 of file LogCategory.cpp.

References categories_, defaultVerbosity_, mutex_, and EngineCore::verbosityToString().

Here is the call graph for this function:

◆ setAllVerbosity()

void EngineCore::LogCategoryManager::setAllVerbosity ( LogVerbosity verbosity)

Set verbosity for all categories.

Definition at line 87 of file LogCategory.cpp.

References categories_, defaultVerbosity_, and mutex_.

◆ setVerbosity()

bool EngineCore::LogCategoryManager::setVerbosity ( const std::string & categoryName,
LogVerbosity verbosity )

Set verbosity for a specific category

Returns
true if category was found and updated

Definition at line 76 of file LogCategory.cpp.

References categories_, and mutex_.

Member Data Documentation

◆ categories_

std::unordered_map<std::string, LogCategory*> EngineCore::LogCategoryManager::categories_
private

◆ defaultVerbosity_

LogVerbosity EngineCore::LogCategoryManager::defaultVerbosity_ = LogVerbosity::Info
private

Definition at line 188 of file LogCategory.h.

Referenced by loadConfig(), saveConfig(), and setAllVerbosity().

◆ mutex_

std::mutex EngineCore::LogCategoryManager::mutex_
mutableprivate

The documentation for this class was generated from the following files:
  • /home/magerbeton/Documents/gl3-vulkan/Engine/include/Engine/Logging/LogCategory.h
  • /home/magerbeton/Documents/gl3-vulkan/Engine/src/Engine/Logging/LogCategory.cpp