![]() |
CRM64Pro GDK
v0.94
A free cross-platform game development kit built on top of SDL 2.0
|
Classes | |
class | CRM64Pro::LogObj |
class | CRM64Pro::LogMgr |
Macros | |
#define | LM_nullptr 0 |
#define | LM_FILE 2 |
#define | LM_FILEAPPEND 4 |
#define | LM_STDOUT 8 |
#define | LM_CONSOLE 16 |
Functions | |
Sint32 | CRM64Pro::LogObj::info (Sint32 iMode=0) |
Sint32 | CRM64Pro::LogObj::getName (string &sName) |
Uint32 | CRM64Pro::LogObj::getID () |
Sint32 | CRM64Pro::LogObj::init (const string &sAppname, eLogLevel eLL, Sint32 iLM, const string &sFilename="", const string &sAuthor="", const string &sEmail="", const string &sWeb="") |
Sint32 | CRM64Pro::LogObj::pause () |
Sint32 | CRM64Pro::LogObj::resume () |
Sint32 | CRM64Pro::LogObj::status () |
Sint32 | CRM64Pro::LogObj::msg (eLogMessageLevel eLML, char *szFmt,...) |
eLogLevel | CRM64Pro::LogObj::getLogLevel () |
Sint32 | CRM64Pro::LogObj::getLogMode () |
Sint32 | CRM64Pro::LogObj::setLogMode (Sint32 iLM, const string &sFilename="") |
Sint32 | CRM64Pro::LogObj::getFilename (string &sName) |
Sint32 | CRM64Pro::LogObj::setTimeStamp (Sint32 iM) |
Sint32 | CRM64Pro::LogObj::getTimeStamp () |
Sint32 | CRM64Pro::LogMgr::info (Sint32 iMode=0) |
Sint32 | CRM64Pro::LogMgr::create (const string &sName, Uint32 iUnused=0) |
Sint32 | CRM64Pro::LogMgr::close (Sint32 idLog) |
Sint32 | CRM64Pro::LogMgr::getNum () |
Sint32 | CRM64Pro::LogMgr::setName (Sint32 idLog, const string &sName) |
LogObj * | CRM64Pro::LogMgr::get (Sint32 idLog=0) |
The Log Manager handles the creation/destruction of Log Objects and always owns a default log named "default" although it is not initialized.
All CRM64Pro GDK modules use this default log for messages and information output.
The client application can use the default log or create any number of additional log objects using the Log Manager.
A good practice is to initialize the default log using LogObj::init() right after Main::Instance() in order to capture all the GDK initialization messages.
The default log can not be released, and once initialized you can stop the log output using LogObj::pause() method.
There is an useful mode where all the return error codes are logged automatically using the default log if you link against a GDK debug version and set eLogLevel to LL_HIGH.
This is a standard manager: objects are not shared and must be unique using its name as the key, in other words, you can not create an object with the same name of another one already created.
Only a single instance of the Log Manager exists which is created once Main is instantiated.
You can get a reference to this manager using Main::ILogMgr() method.
#define LM_nullptr 0 |
Log output mode. 'lm' parameter in LogObj::Init(), no output at all.
#define LM_FILE 2 |
Log output mode. 'lm' parameter in LogObj::Init(), output to a file, if it already exists, its contents are destroyed.
#define LM_FILEAPPEND 4 |
Log output mode. 'lm' parameter in LogObj::Init(), output to a file, if it already exists, we write at the file end.
#define LM_STDOUT 8 |
Log output mode. 'lm' parameter in LogObj::Init(), output to standard output stream (stdout).
#define LM_CONSOLE 16 |
Log output mode. 'lm' parameter in LogObj::Init(), output to integrated and default console.
enum CRM64Pro::eLogLevel |
The detail level of the LogObj.
The importance of a logged message.
Sint32 CRM64Pro::LogObj::info | ( | Sint32 | iMode = 0 | ) |
Request log object information.
For displaying the information, it uses the default log.
iMode | unused for the time being. |
Sint32 CRM64Pro::LogObj::getName | ( | string & | sName | ) |
Get the name.
sName | a string containing the log name. |
Uint32 CRM64Pro::LogObj::getID | ( | ) |
Get the ID.
Sint32 CRM64Pro::LogObj::init | ( | const string & | sAppname, |
eLogLevel | eLL, | ||
Sint32 | iLM, | ||
const string & | sFilename = "" , |
||
const string & | sAuthor = "" , |
||
const string & | sEmail = "" , |
||
const string & | sWeb = "" |
||
) |
Initialize a log.
sAppname | name of your application. |
eLL | log detail level. Check eLogLevel enum for further information. |
iLM | log mode. Check LM_nullptr, LM_STDOUT, LM_FILE, LM_FILEAPPEND and LM_CONSOLE for further information. You can OR'ed them. |
sFilename | name of log file (only makes sense with LM_FILE or LM_FILEAPPEND). Directory separators '\' and '/' are supported. |
sAuthor | application author name (none by default). |
sEmail | email of author (none by default). |
sWeb | web page of your application (none by default). |
Sint32 CRM64Pro::LogObj::pause | ( | ) |
Pause the log.
Log output is temporary disabled.
Sint32 CRM64Pro::LogObj::resume | ( | ) |
Resume a paused log.
Log output is enabled.
Sint32 CRM64Pro::LogObj::status | ( | ) |
Get the log status.
C64_STATUS_DISABLED | log is disabled (no output). |
C64_STATUS_ENABLED | log is enabled (output depending on the log mode). |
C64_STATUS_PAUSED | log is enabled but is paused (no output). |
Sint32 CRM64Pro::LogObj::msg | ( | eLogMessageLevel | eLML, |
char * | szFmt, | ||
... | |||
) |
Output a message.
eLML | importance of the message. Check eLogMessageLevel enum for further information. |
szFmt | a printf() style message format string. |
... | additional parameters matching % tokens in the fmt string, if any |
eLogLevel CRM64Pro::LogObj::getLogLevel | ( | ) |
Get the log detail level.
Sint32 CRM64Pro::LogObj::getLogMode | ( | ) |
Get the log mode.
Sint32 CRM64Pro::LogObj::setLogMode | ( | Sint32 | iLM, |
const string & | sFilename = "" |
||
) |
Set the log mode.
iLM | log mode. Check LM_nullptr, LM_STDOUT, LM_FILE, LM_FILEAPPEND and LM_CONSOLE for further information. |
sFilename | name of log file (only makes sense with LM_FILE or LM_FILEAPPEND). Directory separators '\' and '/' are supported. |
Sint32 CRM64Pro::LogObj::getFilename | ( | string & | sName | ) |
Get the filename.
sName | a string variable. |
Sint32 CRM64Pro::LogObj::setTimeStamp | ( | Sint32 | iM | ) |
Print the time stamp for each logged message.
By default, it is disabled.
It only works with LM_FILE or LM_FILEAPPEND modes.
It does not display any information to console system.
iM | 0 to disable it or any other value for enabling it. |
Sint32 CRM64Pro::LogObj::getTimeStamp | ( | ) |
Get the time stamp mode.
Sint32 CRM64Pro::LogMgr::info | ( | Sint32 | iMode = 0 | ) |
Request Log Manager information.
For displaying the information, it uses the default log.
iMode | -1 for displaying only Manager information. 0 for displaying Manager and all Objects information. This is the default value. idLog for displaying Manager and given Log id information. |
Sint32 CRM64Pro::LogMgr::create | ( | const string & | sName, |
Uint32 | iUnused = 0 |
||
) |
Creates a new log.
sName | The name to give to the log object (e.g. 'myLog'). The object name must be unique and with a maximum size of 64 characters or will be truncated. |
iUnused | unused for the time being. |
Sint32 CRM64Pro::LogMgr::close | ( | Sint32 | idLog | ) |
Close and destroy a log.
idLog | 0 for closing all logs or the Log id. The default log is automatically created and can not be removed with this method. |
Sint32 CRM64Pro::LogMgr::getNum | ( | ) |
Get number of loaded objects.
Sint32 CRM64Pro::LogMgr::setName | ( | Sint32 | idLog, |
const string & | sName | ||
) |
Change the object name.
idLog | Log id. |
sName | The name to give to the log object (e.g. 'myLog'). The object name must be unique and with a maximum size of 64 characters or will be truncated. |
LogObj * CRM64Pro::LogMgr::get | ( | Sint32 | idLog = 0 | ) |
Get a pointer to the log using its handler.
idLog | Log id. With 0 (default value), it returns the default log. |