Introduction to the Debug System

The Debug System consists of multiple classes, including:

The Application::Application constructor automatically constructs a DebugProvider, initially with a DebugSink not displaying any debug messages.

The Applications DebugProvider can be access anytime using:

Application::Debug()

Application::Debug()->Warning("This is a warning\n");
or
Application::Debug()->Fatal("This is a fatal error\n");

as said above, debug messages will not be visible by default.
You as developer can easily create a new DebugSink making the message visible using:

If you prefer a DebugWindow, just use:

Application::Debug()->SetSink(new DebugSinkWindow("SkyPad", Rect(100, 100, 300,300));
From now on all debug messages will be printed into the window (based on a ListView).

Optionally you can also use a DebugSinkConsole (to show the messages on the console) or a DebugSinkDebugLog.

If you used the Application::Application(int argc, char *argv[]) constructor than the user has the option to activate the debug system using either

--debug
or
--debugwin
as executable arguments.

Furthermore you have the option to create multiple DebugProviders (for instance, one for the Application itself, and one just for FTP data stream debug) and enable/disable them on demand.

Debug Variables
Every DebugProvider may support a number of Debug Variables. This variable can be set using:
void pDebugProvider->Set(const String& szKey, int iValue);

and checked with:

int pDebugProvider->Set(const String& szKey);

By default, the application debug provider already has a few debug variables. For instance, if you do:

Application::Debug()->Set("ShowUsedWindows", true)
will dump a list of still active windows everytime a window gets closed.

Using a DebugProvider in your application
To add an application local debug provider (with a debug window and a debug variable), just do:

...
DebugProvider *pDebugProvider = new DebugProvider();
pDebugProvider->SetSink(new DebugWindow("Debug messages", Rect(0,0,300,400));

pDebugProvider->Set("DumpProgressInformation", true);

...
...
...

if (pDebugProvider->Get("DumpProgressInformation"))
{
    pDebugProvider->Note("Made progress. just to let you know");
}
...
...

Generated on Thu Dec 13 18:13:55 2007 for SkyGI by  doxygen 1.5.1-p1