The debug module provides debugging utilities to the Anchor platform.
$ component install anchorjs/debug
$ volo add anchorjs/debug
This module allows you to enable one or more topic-specific debugging functions.
Simply invoke the exported function to generate your debug function, passing it
a name which will determine if a noop function is returned, or a decorated
console.log
.
debug = debug('xmpp');
client.on('stanza', function(stanza) {
debug('stanza from: ' + stanza.from);
});
To enable a topic, call debug.enable
.
debug.enable('xmpp');
For convenience, the debug module can be loaded via a script tag, so debug topics can be enabled prior to module loading.
<script src="js/lib/debug/debug.js"></script>
anchor.debug.enable('bosh');
anchor.debug.enable('xmpp');
require(['app/app']);
This module conforms to the interface exported by debug.
This module uses the AMD format. To include in component builds, use component-amd:
component build -u component-amd
To run tests in a browser, execute the Make target for the desired browser:
$ make test-chrome
$ make test-firefox
$ make test-safari
Headless tests can be executed directly from a terminal:
$ make test-phantomjs
Copyright (c) 2012-2013 Jared Hanson <http://jaredhanson.net/>
Copyright (c) 2011 TJ Holowaychuk <[email protected]>