DP_Debug:
Logging Information to the Console

Back to the Main Page

All of these examples assume that the library has been imported as noted in the Documentation.

Logging information to the console is a simple task and can replace tedious alert()-based debugging. For example you might want to log when a counter has reached a certain value, to do this you could do the following:

if ( Cnt == 100 ) { DP_Debug.logger("Cnt has reached 100", "Info") };

Just like the system alert() method you can also include variables and other expressions in your message. For example:

DP_Debug.logger("Cnt is: " + Cnt, "Info");

Any string can be used as the value of the "Type" attribute. Such custom types will not be color-coded however.

DP_Debug.logger("Cnt is: " + Cnt, "Watch Cnt");

You can: