| 14 |
* $Id$ |
* $Id$ |
| 15 |
* |
* |
| 16 |
* $Log$ |
* $Log$ |
| 17 |
|
* Revision 1.4 2003/04/08 17:57:29 joko |
| 18 |
|
* minor fix: increased width of debug-box |
| 19 |
|
* |
| 20 |
|
* Revision 1.3 2003/04/06 04:25:41 joko |
| 21 |
|
* + function get_last |
| 22 |
|
* + function out_plain_last10 |
| 23 |
|
* |
| 24 |
* Revision 1.2 2003/04/05 21:19:38 joko |
* Revision 1.2 2003/04/05 21:19:38 joko |
| 25 |
* + function event |
* + function event |
| 26 |
* - function warn |
* - function warn |
| 58 |
|
|
| 59 |
class Tracer { |
class Tracer { |
| 60 |
|
|
| 61 |
function box($dom_id = 'errorbox') { |
function get_last($x) { |
| 62 |
global $_TRACE; |
global $_TRACE; |
| 63 |
|
return array_slice($_TRACE, -$x); |
| 64 |
|
} |
| 65 |
|
|
| 66 |
|
function box($dom_id = 'errorbox') { |
| 67 |
|
|
| 68 |
// FIXME: ie/mozilla? |
// FIXME: ie/mozilla? |
| 69 |
$errblock = html_div(); |
$errblock = html_div(); |
| 70 |
$errblock->set_id($dom_id); |
$errblock->set_id($dom_id); |
| 71 |
$errblock->set_style('display:none;'); |
|
| 72 |
|
// V1 |
| 73 |
|
//$errblock->set_style('display:none;'); |
| 74 |
|
// V2 |
| 75 |
|
//$errblock->set_style('visibility:hidden; float:none; left: 50%; position:absolute; z-index:1;'); |
| 76 |
|
$errblock->set_style('visibility:hidden; position:absolute; z-index:1; left:5px; background: #eeeeee; margin-top:30px; padding:5px; border:1px solid black;'); |
| 77 |
|
|
| 78 |
|
//$errblock->add( html_br(), html_br() ); |
| 79 |
$errblock->add( html_b( "Events: (# " . sizeof($_TRACE) . ")" ) ); |
$errblock->add( html_b( "Events: (# " . sizeof($_TRACE) . ")" ) ); |
| 80 |
|
|
| 81 |
// FIXME: just use the last 50 entries... |
// FIXME: just use the last 50 entries... |
| 82 |
$last50 = array_slice($_TRACE, -50); |
$lastX = Tracer::get_last(50); |
| 83 |
foreach ($last50 as $error) { |
foreach ($lastX as $error) { |
| 84 |
$errblock->add( $error ); |
$errblock->add( $error ); |
| 85 |
} |
} |
| 86 |
//$errblock->add($_TRACE); |
//$errblock->add($_TRACE); |
| 87 |
|
|
| 88 |
return $errblock; |
return $errblock; |
| 89 |
} |
} |
| 90 |
|
|
| 91 |
|
function out_plain_last10($dom_id) { |
| 92 |
|
$errblock = html_div(); |
| 93 |
|
$errblock->set_id($dom_id); |
| 94 |
|
$errblock->set_style('display:none;'); |
| 95 |
|
$lastX = Tracer::get_last(10); |
| 96 |
|
$errblock->add( join("\n---\n", $lastX) ); |
| 97 |
|
return $errblock; |
| 98 |
|
} |
| 99 |
|
|
| 100 |
function add($payload = null) { |
function add($payload = null) { |
| 101 |
global $_TRACE; |
global $_TRACE; |
| 146 |
|
|
| 147 |
$buf = array(); |
$buf = array(); |
| 148 |
//print "<hr/><b><font color=\"red\">ERROR:</font></b><br/>"; |
//print "<hr/><b><font color=\"red\">ERROR:</font></b><br/>"; |
| 149 |
array_push($buf, "<div style=\"background:$color; margin:4px; border:1px black groove; padding:2px;\"><b><font color=\"red\">Event:</font></b> [$code]<br/>"); |
array_push($buf, "<div style=\"width:640px;background:$color; margin:4px; border:1px black groove; padding:2px;\"><b><font color=\"red\">Event:</font></b> [$code]<br/>"); |
| 150 |
|
|
| 151 |
// 1. dump of error object |
// 1. dump of error object |
| 152 |
if (is_array($error)) { |
if (is_array($error)) { |