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));
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
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)
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"); } ... ...
1.5.1-p1