function wf_debug(name, obj)
{
	if(typeof wf_level == 'undefined')
		wf_level = 0;
	
	function create_debug_method(obj, method_name)
	{
		obj['_wf_debug_' + method_name] = obj[method_name];
		
		return function()
		{
			++wf_level;
			var prefix = '';
			
			for(var i = 0; i < wf_level; ++i)
				prefix += '-';
			
			console.log(prefix + name + '.' + method_name, arguments);
			
			var res = obj['_wf_debug_' + method_name].apply(this, arguments);
			
			//console.log(res);
			
			--wf_level;
			
			return res;
		};
	}
	
	for(var p in obj)
	{
		if(!obj.hasOwnProperty(p))
			continue;
			
		if(typeof obj[p] != 'function')
			continue;
			
		obj[p] = create_debug_method(obj, p); 
	}
}
