FIFE
be64c707dea6b3250bd4355bf5c825d25920087d
|
Logmanager takes care of log filtering and output direction. More...
#include <logger.h>
Public Types | |
enum | LogLevel { LEVEL_DEBUG = 0, LEVEL_LOG = 1, LEVEL_WARN = 2, LEVEL_ERROR = 3, LEVEL_PANIC = 4 } |
Loglevel is used to set a treshold for output messages + related filter E.g. More... | |
Public Member Functions | |
~LogManager () | |
Destructor. More... | |
void | log (LogLevel level, logmodule_t module, const std::string &msg) |
Logs given message. More... | |
void | setLevelFilter (LogLevel level) |
Sets currently used level filter. More... | |
LogLevel | getLevelFilter () |
Gets currently used level filter. More... | |
void | addVisibleModule (logmodule_t module) |
Adds visible module into logmanager Module corresponds some module in the engine. More... | |
void | removeVisibleModule (logmodule_t module) |
Removes visible module,. More... | |
void | clearVisibleModules () |
Removes all visible modules,. More... | |
bool | isVisible (logmodule_t module) |
Tells if given module is visible. More... | |
void | setLogToPrompt (bool logtoprompt) |
Sets LogManager to log to prompt. More... | |
bool | isLogToPrompt () |
Returns if LogManager is set to log to prompt. More... | |
void | setLogToFile (bool logtofile) |
Sets LogManager to log to a file. More... | |
bool | isLogToFile () |
Returns if LogManager is set to log to a file. More... | |
std::string | getModuleName (logmodule_t module) |
Gets display name for given module id E.g. More... | |
Static Public Member Functions | |
static LogManager * | instance () |
Returns instance to log manager. More... | |
Private Member Functions | |
void | validateModule (logmodule_t m) |
LogManager () | |
void | validateModuleDescription (logmodule_t module) |
Private Attributes | |
LogLevel | m_level |
bool | m_modules [LM_MODULE_MAX] |
std::vector< logmodule_t > | module_check_stack |
bool | m_logtofile |
bool | m_logtoprompt |
std::ofstream * | m_logfile |
Static Private Attributes | |
static LogManager * | m_instance = NULL |
Logmanager takes care of log filtering and output direction.
FIFE::LogManager::~LogManager | ( | ) |
Destructor.
Definition at line 72 of file logger.cpp.
|
private |
Definition at line 177 of file logger.cpp.
References clearVisibleModules(), LM_CORE, m_logfile, and validateModuleDescription().
void FIFE::LogManager::addVisibleModule | ( | logmodule_t | module | ) |
Adds visible module into logmanager Module corresponds some module in the engine.
Modules may contain other modules. Modules and their structure is defined in file modules.h. In case module is not visible, LogManager filters corresponding log messages from output. In case some lower-level module is set visible, it also sets all upper level modules visible
module | module to set visible |
Definition at line 123 of file logger.cpp.
References LM_CORE.
void FIFE::LogManager::clearVisibleModules | ( | ) |
Removes all visible modules,.
Definition at line 137 of file logger.cpp.
References LM_MODULE_MAX.
Referenced by LogManager().
LogManager::LogLevel FIFE::LogManager::getLevelFilter | ( | ) |
Gets currently used level filter.
Definition at line 119 of file logger.cpp.
std::string FIFE::LogManager::getModuleName | ( | logmodule_t | module | ) |
Gets display name for given module id E.g.
LM_AUDIO -> "Audio"
Definition at line 216 of file logger.cpp.
|
static |
Returns instance to log manager.
Log manager is a singleton class
Definition at line 65 of file logger.cpp.
Referenced by FIFE::Engine::Engine(), and FIFE::Logger::log().
bool FIFE::LogManager::isLogToFile | ( | ) |
Returns if LogManager is set to log to a file.
Definition at line 163 of file logger.cpp.
bool FIFE::LogManager::isLogToPrompt | ( | ) |
Returns if LogManager is set to log to prompt.
Definition at line 147 of file logger.cpp.
bool FIFE::LogManager::isVisible | ( | logmodule_t | module | ) |
void FIFE::LogManager::log | ( | LogLevel | level, |
logmodule_t | module, | ||
const std::string & | msg | ||
) |
Logs given message.
level | level of this log (e.g. warning) |
module | module where this log message is coming from. Modules are defined in modules.h-file |
msg | message to log |
Definition at line 77 of file logger.cpp.
Referenced by FIFE::Logger::log().
void FIFE::LogManager::removeVisibleModule | ( | logmodule_t | module | ) |
void FIFE::LogManager::setLevelFilter | ( | LogLevel | level | ) |
Sets currently used level filter.
For usage,
Definition at line 115 of file logger.cpp.
void FIFE::LogManager::setLogToFile | ( | bool | logtofile | ) |
Sets LogManager to log to a file.
Definition at line 151 of file logger.cpp.
void FIFE::LogManager::setLogToPrompt | ( | bool | logtoprompt | ) |
Sets LogManager to log to prompt.
Definition at line 143 of file logger.cpp.
|
private |
Definition at line 187 of file logger.cpp.
References LM_CORE, and LM_MODULE_MAX.
|
private |
Definition at line 194 of file logger.cpp.
References LM_CORE, LM_MODULE_MAX, and module_check_stack.
Referenced by LogManager().
|
staticprivate |
|
private |
Definition at line 202 of file logger.h.
Referenced by LogManager().
|
private |
|
private |
Definition at line 197 of file logger.h.
Referenced by validateModuleDescription().