The Debugger module provides a centralized logging solution for SpringRoll games.
Debugger.log('general', 'A general log');
Debugger.log('log', 'Normal log');
Debugger.log('warn', 'A warning');
Debugger.log('debug', 'A debug message');
Debugger.log('error', 'An error has occurred');
The debugger can be toggled off with the enable flag:
Debugger.enable(false);
For more fine-grained control, you can set the minimum logging level:
Debugger.minLevel('WARN');
Now, only WARN
and ERROR
level messages will print, and GENERAL
, DEBUG
, and INFO
will not.
In particular, the message levels are as follows:
GENERAL
: 1DEBUG
: 2INFO
: 3WARN
: 4ERROR
: 5
Due to the message level ordering, if the minimum debug level is set to INFO
, then DEBUG
and GENERAL
are disabled
and will not print, but WARN
and ERROR
will still print.
This mapping is programmatically accessible from Debugger.LEVEL
.