Exemplo n.º 1
0
    function fetchLog()
    {
        global $cfg;
        if ($cfg['servertype'] == 'prod') {
            return "";
        }
        if ($this->enabled) {
            $this->printed = true;
            ob_start();
            ?>
	    <div id="log">
	        <table id="log" border="1" summary="table">
	    	<thead>
			<?php 
            print LogEntry::getHeader();
            ?>
	    	</thead>
	    	<tbody>
			<?php 
            for ($i = count($this->entries) - 1; $i >= 0; $i--) {
                $row = $this->entries[$i];
                print $row->getEntry();
            }
            ?>
	    	    <tr>
			    <?php 
            $peak_mem = sprintf("%.3f MB", memory_get_peak_usage() / 1000000);
            $memory_limit = ini_get('memory_limit');
            if (function_exists("xdebug_is_enabled") && xdebug_is_enabled()) {
                $time_in_db = Dbase::get_all_timer_info();
                $time = sprintf("%.3f ms", xdebug_time_index() * 1000);
            }
            echo <<<EOT
\t\t<pre>
\t\tFinal Debugging Info
\t\tTotal time taken      : {$time}
\t\tPeak Memory Used      : {$peak_mem}
\t\tTime spend in DB      : {$time_in_db}
\t\tMemory Limit          : {$memory_limit};
\t\t</pre>
EOT;
            ?>
	    	    </tr>
	    	</tbody>
	        </table>
	    </div>
	    <?php 
            return ob_get_clean();
            //return  "Log: ".$this->getLevel()."\n".str_replace("<br />","\n", $this->msg)." ";
        }
    }