![]() |
CRM64Pro GDK v0.13.0
A free cross-platform game development kit built on top of SDL 3.0
|
Log Manager and Log objects for application and GDK message output [v25.12.0].
The Log module handles all logging output for both the client application and the GDK itself. The Log Manager handles the creation and destruction of Log objects and always owns a default log named "default" (although it is not initialized by default).
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.
The Log Manager always owns a default log named "default" with special characteristics:
| Initialization | Not initialized by default; call Log::init() to enable output |
|---|---|
| GDK usage | All CRM64Pro GDK modules output messages through this log |
| Release protection | Cannot be released; use Log::pause() to stop output |
An automatic error code logging mode is available when both conditions are met:
| GDK version | Link against a GDK debug version |
|---|---|
| Log level | Set eLogLevel to LL_HIGH |
When enabled, all return error codes are automatically logged to the default log.
This is a standard manager: objects are not shared and must be unique using its name as the key. You cannot create an object with the same name as another one already created.
Classes | |
| class | CRM64Pro::Log |
| Log Object class. More... | |
| class | CRM64Pro::LogMgr |
| Log Manager class. More... | |
Macros | |
| #define | LM_NULL 0 |
| #define | LM_FILE 2 |
| #define | LM_FILEAPPEND 4 |
| #define | LM_STDOUT 8 |
| #define | LM_CONSOLE 16 |
| #define | LM_RESERVED 64 |
Enumerations | |
| enum | CRM64Pro::eLogLevel { CRM64Pro::LL_LOW = 0 , CRM64Pro::LL_NORMAL = 4 , CRM64Pro::LL_HIGH = 16 } |
| Log verbosity. More... | |
| enum | CRM64Pro::eLogMessageLevel { CRM64Pro::LML_CRITICAL = 0 , CRM64Pro::LML_NORMAL = 4 , CRM64Pro::LML_LOW = 16 , CRM64Pro::LML_INFO = 64 , CRM64Pro::LML_NULL = 128 } |
| Importance of a logged message. More... | |
Functions | |
| Sint32 | CRM64Pro::Log::info (Sint32 iMode=0) |
| Request Log object information. | |
| Sint32 | CRM64Pro::Log::getName (string &sName) |
| Get the name. | |
| Uint32 | CRM64Pro::Log::getID () |
| Get the ID. | |
| Sint32 | CRM64Pro::Log::init (const string &sAppname, eLogLevel eLL, Sint32 iLM, const string &sFilename="", const string &sAuthor="", const string &sEmail="", const string &sWeb="") |
| Initialize the log object. | |
| Sint32 | CRM64Pro::Log::pause () |
| Disable log output temporarily. | |
| Sint32 | CRM64Pro::Log::resume () |
| Enable log output. | |
| Sint32 | CRM64Pro::Log::status () |
| Get log status. | |
| Sint32 | CRM64Pro::Log::msg (eLogMessageLevel eLML, const char *szFmt,...) |
| Write a message to the log. | |
| eLogLevel | CRM64Pro::Log::getLogLevel () |
| Get log detail level. | |
| Sint32 | CRM64Pro::Log::getLogMode () |
| Get log mode. | |
| Sint32 | CRM64Pro::Log::setLogMode (Sint32 iLM, const string &sFilename="") |
| Set log mode. | |
| Sint32 | CRM64Pro::Log::getFilename (string &sName) |
| Get log filename. | |
| Sint32 | CRM64Pro::Log::setTimeStamp (Sint32 iM) |
| Enable/disable timestamp in log messages. | |
| Sint32 | CRM64Pro::Log::getTimeStamp () |
| Get timestamp status. | |
| Sint32 | CRM64Pro::LogMgr::info (Sint32 iMode=0) |
| Request Log Manager information. | |
| Sint32 | CRM64Pro::LogMgr::create (const string &sName, Uint32 iUnused=0) |
| Create a new log object. | |
| Sint32 | CRM64Pro::LogMgr::close (Sint32 idLog) |
| Close and destroy a log object. | |
| Sint32 | CRM64Pro::LogMgr::getNum () const |
| Get number of loaded objects. | |
| Sint32 | CRM64Pro::LogMgr::setName (Sint32 idLog, const string &sName) |
| Change the object name. | |
| Log * | CRM64Pro::LogMgr::get (Sint32 idLog=0) |
| Get a pointer to the log object. | |
| #define LM_NULL 0 |
Log output mode for the 'lm' parameter in CRM64Pro::Log::init(). Disable output entirely.
| #define LM_FILE 2 |
Log output mode for the 'lm' parameter in CRM64Pro::Log::init(). Output to a file and overwrite existing content.
| #define LM_FILEAPPEND 4 |
Log output mode for the 'lm' parameter in CRM64Pro::Log::init(). Output to a file, appending to existing content.
| #define LM_STDOUT 8 |
Log output mode for the 'lm' parameter in CRM64Pro::Log::init(). Output to standard output (stdout).
| #define LM_CONSOLE 16 |
Log output mode for the 'lm' parameter in CRM64Pro::Log::init(). Output to the integrated default console.
| #define LM_RESERVED 64 |
Log output mode reserved for internal use; do not use it.
| enum CRM64Pro::eLogLevel |
Log verbosity.
| Enumerator | |
|---|---|
| LL_LOW | 'll' parameter in Log::init(). Logs ::LML_CRITICAL and ::LML_INFO messages only. |
| LL_NORMAL | 'll' parameter in Log::init(). Adds ::LML_NORMAL messages. |
| LL_HIGH | 'll' parameter in Log::init(). Adds ::LML_LOW messages. |
Importance of a logged message.
| Enumerator | |
|---|---|
| LML_CRITICAL | 'lml' parameter in Log::msg(). Logged on all log levels. Use for critical errors. |
| LML_NORMAL | 'lml' parameter in Log::msg(). Logged on ::LL_NORMAL and ::LL_HIGH. Use for errors and warnings. |
| LML_LOW | 'lml' parameter in Log::msg(). Logged on ::LL_HIGH. Use for warnings and debugging messages. |
| LML_INFO | 'lml' parameter in Log::msg(). Logged on all log levels. Timestamp not supported. Use for informational messages. |
| LML_NULL | 'lml' parameter in Log::msg(). Do not log anything. |
| Sint32 CRM64Pro::Log::info | ( | Sint32 | iMode = 0 | ) |
Request Log object information.
Writes object information to the default log.
| iMode | unused for the time being. |
| Sint32 CRM64Pro::Log::getName | ( | string & | sName | ) |
Get the name.
| sName | string containing the log name. |
| Uint32 CRM64Pro::Log::getID | ( | ) |
Get the ID.
| Sint32 CRM64Pro::Log::init | ( | const string & | sAppname, |
| eLogLevel | eLL, | ||
| Sint32 | iLM, | ||
| const string & | sFilename = "", | ||
| const string & | sAuthor = "", | ||
| const string & | sEmail = "", | ||
| const string & | sWeb = "" ) |
Initialize the log object.
| sAppname | name of your application. |
| eLL | log verbosity. See ::eLogLevel. |
| iLM | log mode. See LM_NULL, LM_STDOUT, LM_FILE, LM_FILEAPPEND and LM_CONSOLE. |
| sFilename | name of log file. Only used with LM_FILE or LM_FILEAPPEND. Directory separators '\' and '/' are supported. |
| sAuthor | author name. |
| sEmail | author email address. |
| sWeb | author web site. |
| Sint32 CRM64Pro::Log::pause | ( | ) |
Disable log output temporarily.
Temporarily disables log output.
| Sint32 CRM64Pro::Log::resume | ( | ) |
Enable log output.
Re-enables log output.
| Sint32 CRM64Pro::Log::status | ( | ) |
Get log status.
| Sint32 CRM64Pro::Log::msg | ( | eLogMessageLevel | eLML, |
| const char * | szFmt, | ||
| ... ) |
Write a message to the log.
| eLML | importance of the message. See ::eLogMessageLevel. |
| szFmt | a printf() style message format string. |
| eLogLevel CRM64Pro::Log::getLogLevel | ( | ) |
Get log detail level.
| Sint32 CRM64Pro::Log::getLogMode | ( | ) |
Get log mode.
| Sint32 CRM64Pro::Log::setLogMode | ( | Sint32 | iLM, |
| const string & | sFilename = "" ) |
Set log mode.
| iLM | log mode. See LM_NULL, LM_STDOUT, LM_FILE, LM_FILEAPPEND and LM_CONSOLE. |
| sFilename | name of log file (only relevant with LM_FILE or LM_FILEAPPEND). Directory separators '\' and '/' are supported. |
| Sint32 CRM64Pro::Log::getFilename | ( | string & | sName | ) |
Get log filename.
| sName | string filled with the current filename. |
| Sint32 CRM64Pro::Log::setTimeStamp | ( | Sint32 | iM | ) |
Enable/disable timestamp in log messages.
Disabled by default. Only works with LM_FILE or LM_FILEAPPEND modes. Does not display timestamps in console output.
| iM | 0 to disable or any other value to enable. |
| Sint32 CRM64Pro::Log::getTimeStamp | ( | ) |
Get timestamp status.
| Sint32 CRM64Pro::LogMgr::info | ( | Sint32 | iMode = 0 | ) |
Request Log Manager information.
Writes manager information to the default log.
| iMode | -1 to display only manager information. 0 (default) to include manager and all objects. |
| Sint32 CRM64Pro::LogMgr::create | ( | const string & | sName, |
| Uint32 | iUnused = 0 ) |
Create a new log object.
| sName | name for the log object (e.g. 'myLog'). Must be unique; longer names are truncated to 64 characters. |
| iUnused | unused for the time being. |
| Sint32 CRM64Pro::LogMgr::close | ( | Sint32 | idLog | ) |
Close and destroy a log object.
| idLog | 0 to close all logs, or a specific log id. The default log cannot be removed with this method. |
| Sint32 CRM64Pro::LogMgr::getNum | ( | ) | const |
Get number of loaded objects.
| Sint32 CRM64Pro::LogMgr::setName | ( | Sint32 | idLog, |
| const string & | sName ) |
Change the object name.
| idLog | Log id. |
| sName | new name (e.g. 'myLog'). Must be unique; longer names are truncated to 64 characters. |