function newTrackMethod(obj, name, cached, opt) {
	var colorCall = opt.colors ? color.green : nocolor;
	var colorReturn = opt.colors ? color.red : nocolor;
	var colorElapsed = opt.colors ? color.blue : nocolor;

	return function() {
		var args = Array.prototype.slice.call(arguments);
		var time = +new Date();

		// format method call
		var msg = colorCall(' --> ');
		msg += obj.constructor.name + '.' + name;
		if (opt.showArguments) msg += '(' + Bugme.inspectArgument(args, { colors: opt.colors }) + ')';
		Bugme.print(msg);

		// call tracked method
		var ret = obj[cached].apply(this, arguments);
		var elapsed = +new Date() - time;

		// format method return
		var msg = colorReturn(' <-- ');
		msg += obj.constructor.name + '.' + name;
		msg += '(' + colorElapsed(elapsed + ' ms') + ')';
		if (opt.showReturn) msg += ' => ' + Bugme.inspectReturn(ret, { colors: opt.colors });
		Bugme.print(msg);

		return ret;
	};
}
/**
 * Create wrapper method for tracking method calls.
 * Prints entry and leave messages and method run time.
 */
Create wrapper method for tracking method calls.
Prints entry and leave messages and method run time.
Create wrapper method for tracking method calls . Prints entry and leave messages and method run time .
function newTrackMethod(obj, name, cached, opt) {
	var colorCall = opt.colors ? color.green : nocolor;
	var colorReturn = opt.colors ? color.red : nocolor;
	var colorElapsed = opt.colors ? color.blue : nocolor;
	return function() {
		var args = Array.prototype.slice.call(arguments);
		var time = +new Date();
		var msg = colorCall(' --> ');
		msg += obj.constructor.name + '.' + name;
		if (opt.showArguments) msg += '(' + Bugme.inspectArgument(args, { colors: opt.colors }) + ')';
		Bugme.print(msg);
		var ret = obj[cached].apply(this, arguments);
		var elapsed = +new Date() - time;
		var msg = colorReturn(' <-- ');
		msg += obj.constructor.name + '.' + name;
		msg += '(' + colorElapsed(elapsed + ' ms') + ')';
		if (opt.showReturn) msg += ' => ' + Bugme.inspectReturn(ret, { colors: opt.colors });
		Bugme.print(msg);
		return ret;
	};
}
function newTrackMethod ( obj , name , cached , opt ) { var colorCall = opt . colors ? color . green : nocolor ; var colorReturn = opt . colors ? color . red : nocolor ; var colorElapsed = opt . colors ? color . blue : nocolor ; return function ( ) { var args = Array . prototype . slice . call ( arguments ) ; var time = + new Date ( ) ; var msg = colorCall ( ' --> ' ) ; msg += obj . constructor . name + '.' + name ; if ( opt . showArguments ) msg += '(' + Bugme . inspectArgument ( args , { colors : opt . colors } ) + ')' ; Bugme . print ( msg ) ; var ret = obj [ cached ] . apply ( this , arguments ) ; var elapsed = + new Date ( ) - time ; var msg = colorReturn ( ' <-- ' ) ; msg += obj . constructor . name + '.' + name ; msg += '(' + colorElapsed ( elapsed + ' ms' ) + ')' ; if ( opt . showReturn ) msg += ' => ' + Bugme . inspectReturn ( ret , { colors : opt . colors } ) ; Bugme . print ( msg ) ; return ret ; } ; }
Create wrapper method for tracking method calls.
Create wrapper method for tracking method calls .
// format method call // call tracked method // format method return