Newer
Older
Digital_Repository / Repositories / statistics / includes / inc.class.show_debug.es.php
<?php
/**
 * Project:     ePrintsStats project
 * File:        inc.class.show_debug.es.php
 * Description: Display debugging in a meaningful way.
 *     $debug = new ShowDebug();
 *	   $debug->setDebug($GLOBALS["db_values"],__LINE__,__FILE__,'','','');
 *     // Add this where the debug output should appear
 *     print $debug->getDebug();
 *              
 */

class ShowDebug {
	var $_debug = array();

	function setDebug($output,$line,$file,$function,$class,$method)
	{
		ob_start();
		print "<div class=\"debug\">\n";
		print "<pre>";
		if (!empty($line)) { print "LINE: $line\n"; };
		if (!empty($file)) { print "FILE: $file\n"; };
		if (!empty($function)) { print "FUNCTION: $function\n"; };
		if (!empty($class)) { print "CLASS: $class\n"; };
		if (!empty($method)) { print "METHOD: $method\n"; };
		print_r($output);
		print "</ pre></div>";
		$ret_str = ob_get_contents();
		ob_end_clean();	
		$this->_debug[] = $ret_str;
	}
	function getDebug()
	{
		$_outstring = '';
		foreach ($this->_debug as $k=>$v) {
			$_outstring .= $v;	
		}
		return $_outstring;
	}

}

?>