ydn.debug

YDN debug module.

Debug module is only exposed in dev distribution. Debug codes including logging, assertion and debug error classes are stripped in production distribution.

Static Methods
log(scope, level, ele)
Enable logging and set log level.

Logging is enable by module or specific class by calling log. This can be called as necessary.

ydn.debug.log('ydn', 900); // show warning for all ydn modules.
ydn.debug.log('ydn.db.crud.req.IndexedDb', 'finest'); // show finest detail for ydn.db.crud.req.IndexedDb class.
ydn.debug.log('ydn.db.tr', 'off'); // do not show from database transaction module.

By default logging messages are displayed in browser console. It can be display on DOM element as follow.

var div = document.createElement('DIV');
document.body.appendChild(div);
ydn.debug.log('ydn', 'warning', div); 
Parameters:
{string} scope
Module namespace as logging scope. Eg: 'ydn.db' for YDN database module.
{string|number} level
Logging level. Logging level starts from 0 (all) to infinity (off). Other canned values are warning (900), info (800), fine (500), finer (400), finest (500).
{Element=} ele
Optional. Div element to be displayed log messages.