Version 3, last updated by Ying at October 24, 2008 18:19 UTC
* @name : iLog Library
* @author : Ying
* @date : 28,6,2008
* @Description:
This is a library specifically for Game Loging, and works as follows.
* Preparation for use:
- Copy all the files to your project folder. All the .h must be in the
same folder
- In Code::Blocks right click on the project name, "build options" and there
click on the project name, NOT debug or release. Go to "linker settings"
and in "Link Libraries" add iLog.
- Now go to "Search Directories"->"Linker" and add the path where the
dll and .h are
- Include the iLog.h in your project.
* Actual use:
- In the file you want to use it #include "iLog.h" at the top of the file
- There are 3 levels of debug, but basically we'll be working with 2,
LOGGL1 and LOGGL2, the first one corresponds to release builds and will
show the messages on both debug and release builds, and the second one
is only for debugging purposes and will not show up on release.
- To LOG you use either:
LOGGL1 << "Text to be logged and will show alwais" << WRITEL1( LOG_XXXXXXX );
LOGGL2 << "This var: " << someVar << "shows only on debug" << WRITEL2( LOG_XXXXXXX );
where XXXXXXX is one of 7 different logg messages:
LOG_Unknown, Message that doesnt fit in any cathegory
LOG_Error, Errors that generate during execution
LOG_Warning, Warnings that dont necesarilly affect the execution
LOG_Comment, General style coments for the engines
LOG_Event, Scheduled game events, not Engine
LOG_Debug, For specific bug tracking (this one will be the most used)
LOG_Message, Messages sent by entities.
This will generate a XMLOutputWithComplexXSLT.xml file, wich can then
be viewed with the LogView.html file. So go ahead and double click on
LogView ;)
- To ASSERT you use:
ASSERT << XXXXX << ENDASSERT( condition );
where XXXXXX is any kind of output you want to associate with the assert
macro, and the condition is the assert condition, for example:
ASSERT << "Two was discovered to be unequal to 2" << ENDASSERT(2!=2);
* Optimal use:
In Code::Blocks go to Settings->Editor->Abreviations and there add the
folowing:
Name one "l1" and for code put: "LOGGL1 << | << WRITEL1( LOG_$(Log Type) );"
and another "l2" and the code: "LOGGL2 << | << WRITEL2( LOG_$(Log Type) );"
This way you'll just type l1 and then press (cntrl) + (j) and a dialog box
will ask the log type and then leave you ready to input the log data.
Similarilly, name "ass" for the code:
"ASSERT << | << ENDASSERT( $(Condition) );"