|
|
If you're using windows (as I assume you are :-) why don't you use visual c++'s debugger? If that's not enough, it shouldn't be too hard creating a logfile... hell, why not, here you are :
void System::clearLog() {
#ifdef _DEBUG
FILE* fil = fopen("debug.log", "w");
fclose(fil);
log("My cool logfilen");
#endif
}
void System::log(const char *message, ...) {
#ifdef _DEBUG
char str[256];
va_list args;
va_start(args, message);
vsprintf(str, message, args);
va_end(args);
FILE* fil = fopen("debug.log", "a");
fprintf(fil, "%sn", str);
fclose(fil);
#endif
}
As you can see, clearLog just clears the file and log opens the logfile and stores a string... shouldn't be too hard to use for proper debugging, for instance, I use it in construcors and destructors, to see which objects were created.
Though, open a file each log takes some valuable CPU (I have to this each time to allow multiple instances of the System class), I use the #ifdef _DEBUG to make sure it isn't included in the release version.
And if this isn't good enough, you can type text directly to the debugwindow below your code... but that's described somewhere else :)
Visual C++ is good enough for everyone I beleive.
By the way, as you can see, I like the javasyntax ;)
Albert "thec" Sandberg
|