FIFE  6e1afdbeda11afe9ac53e6023a4be96ef88f1dc6
FIFE::LogManager Class Reference

Logmanager takes care of log filtering and output direction. More...

#include <logger.h>

+ Collaboration diagram for FIFE::LogManager:

Public Types

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 LogManagerinstance ()
 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_tmodule_check_stack
 
bool m_logtofile
 
bool m_logtoprompt
 
std::ofstream * m_logfile
 

Static Private Attributes

static LogManagerm_instance = NULL
 

Detailed Description

Logmanager takes care of log filtering and output direction.

Definition at line 99 of file logger.h.

Member Enumeration Documentation

Loglevel is used to set a treshold for output messages + related filter E.g.

in case log message has LEVEL_WARN, but the filter treshold is LEVEL_ERROR, log message is not outputted

Enumerator
LEVEL_DEBUG 
LEVEL_LOG 
LEVEL_WARN 
LEVEL_ERROR 
LEVEL_PANIC 

Definition at line 105 of file logger.h.

Constructor & Destructor Documentation

FIFE::LogManager::~LogManager ( )

Destructor.

Definition at line 72 of file logger.cpp.

FIFE::LogManager::LogManager ( )
private

Definition at line 177 of file logger.cpp.

References clearVisibleModules(), LM_CORE, m_logfile, and validateModuleDescription().

Member Function Documentation

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

Parameters
modulemodule to set visible

Definition at line 123 of file logger.cpp.

References LM_CORE.

void FIFE::LogManager::clearVisibleModules ( )

Removes all visible modules,.

See also
addVisibleModule

Definition at line 137 of file logger.cpp.

References LM_MODULE_MAX.

Referenced by LogManager().

+ Here is the caller graph for this function:

LogManager::LogLevel FIFE::LogManager::getLevelFilter ( )

Gets currently used level filter.

See also
LogManager::LogLevel

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.

LogManager * FIFE::LogManager::instance ( )
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().

+ Here is the caller graph for this function:

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)

Tells if given module is visible.

Definition at line 167 of file logger.cpp.

References LM_CORE.

void FIFE::LogManager::log ( LogLevel  level,
logmodule_t  module,
const std::string &  msg 
)

Logs given message.

Parameters
levellevel of this log (e.g. warning)
modulemodule where this log message is coming from. Modules are defined in modules.h-file
msgmessage to log
Note
do not use this method directly, instead use FL_WARN (or any other FL_XXX) macro

Definition at line 77 of file logger.cpp.

Referenced by FIFE::Logger::log().

+ Here is the caller graph for this function:

void FIFE::LogManager::removeVisibleModule ( logmodule_t  module)

Removes visible module,.

See also
addVisibleModule

Definition at line 132 of file logger.cpp.

void FIFE::LogManager::setLevelFilter ( LogLevel  level)

Sets currently used level filter.

For usage,

See also
LogManager::LogLevel

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.

void FIFE::LogManager::validateModule ( logmodule_t  m)
private

Definition at line 187 of file logger.cpp.

References LM_CORE, and LM_MODULE_MAX.

void FIFE::LogManager::validateModuleDescription ( logmodule_t  module)
private

Definition at line 194 of file logger.cpp.

References LM_CORE, LM_MODULE_MAX, and module_check_stack.

Referenced by LogManager().

+ Here is the caller graph for this function:

Member Data Documentation

LogManager * FIFE::LogManager::m_instance = NULL
staticprivate

Definition at line 191 of file logger.h.

LogLevel FIFE::LogManager::m_level
private

Definition at line 193 of file logger.h.

std::ofstream* FIFE::LogManager::m_logfile
private

Definition at line 202 of file logger.h.

Referenced by LogManager().

bool FIFE::LogManager::m_logtofile
private

Definition at line 199 of file logger.h.

bool FIFE::LogManager::m_logtoprompt
private

Definition at line 200 of file logger.h.

bool FIFE::LogManager::m_modules[LM_MODULE_MAX]
private

Definition at line 195 of file logger.h.

std::vector<logmodule_t> FIFE::LogManager::module_check_stack
private

Definition at line 197 of file logger.h.

Referenced by validateModuleDescription().


The documentation for this class was generated from the following files: