Members
-
key :string
The key used to store the debug state in
localStorage
. -
Details
-
<readonly> enabled :boolean
Whether or not the debugger is currently enabled.
-
Description
The value for this property is synced with the current state stored in
localStorage
and should never set from outside of this class.Details
Methods
-
enable()
Enable the debugger causing additional info to be logged to the console.
-
Examples
var d = new FooGallery.utils.Debugger( "FOO_DEBUG" ); d.log( "Never logged" ); d.enabled(); d.log( "I am logged!" );
Details
-
disable()
Disable the debugger stopping additional info being logged to the console.
-
Examples
var d = new FooGallery.utils.Debugger( "FOO_DEBUG" ); d.log( "Never logged" ); d.enabled(); d.log( "I am logged!" ); d.disable(); d.log( "Never logged" );
Details
-
log( message [, argN ] )
Logs the supplied message and additional arguments to the console when enabled.
-
Description
This method basically wraps the
console.log
method and simply checks the enabled state of the debugger before passing along any supplied arguments.Parameters
Name Type Attributes Description message
string The message to log to the console.
argN
* <optional> Any number of additional arguments to supply after the message.
Details
-
logf( message, replacements [, argN ] )
Logs the formatted message and additional arguments to the console when enabled.
-
Parameters
Name Type Attributes Description message
string The message containing named
replacements
to log to the console.replacements
Object.<string, *> An object containing key value pairs used to perform a named format on the
message
.argN
* <optional> Any number of additional arguments to supply after the message.
Details