/[cvs]/nfo/php/libs/org.netfrag.app/Tracer.php
ViewVC logotype

Diff of /nfo/php/libs/org.netfrag.app/Tracer.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by joko, Sat Apr 5 21:19:38 2003 UTC revision 1.4 by joko, Tue Apr 8 17:57:29 2003 UTC
# Line 14  Line 14 
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
# Line 51  Exporter::export_symbol('Tracer', array( Line 58  Exporter::export_symbol('Tracer', array(
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;
# Line 120  class Tracer { Line 146  class Tracer {
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)) {

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.4

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed