/[cvs]/nfo/php/libs/org.netfrag.glib/Class/Logger.php
ViewVC logotype

Diff of /nfo/php/libs/org.netfrag.glib/Class/Logger.php

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

revision 1.3 by joko, Tue Mar 11 01:12:53 2003 UTC revision 1.10 by joko, Fri Mar 28 03:04:26 2003 UTC
# Line 9  Line 9 
9   */   */
10    
11    
12  // ---------------------------------------------------------------------------  /**
13  //  $Id$   * <b>Cvs-Log:</b>
14  // ---------------------------------------------------------------------------   *
15  //  $Log$   * <pre>
16  //  Revision 1.3  2003/03/11 01:12:53  joko   *
17  //  + fixed metadata for phpDocumentor   *  $Id$
18  //   *
19  //  Revision 1.2  2003/03/05 18:54:43  joko   *  $Log$
20  //  updated docu - phpDocumentor is very strict about its 'blocks'...   *  Revision 1.10  2003/03/28 03:04:26  joko
21  //   *  enhanced conditions for debugging
22  //  Revision 1.1  2003/03/03 21:26:43  joko   *
23  //  refactored from DesignPattern::Logger   *  Revision 1.9  2003/03/27 15:59:55  joko
24  //   *  enhanced 'function log'
25  //  Revision 1.4  2003/02/13 00:43:41  joko   *
26  //  + logfile name now can get passed via defined constant   *  Revision 1.8  2003/03/11 02:23:02  joko
27  //   *  + fixed metadata for phpDocumentor
28  //  Revision 1.3  2003/02/09 17:14:49  joko   *
29  //  + now able to redirect errors raised by PEAR to logfile   *  Revision 1.7  2003/03/11 02:14:23  joko
30  //   *  + fixed metadata for phpDocumentor
31  //  Revision 1.2  2003/02/03 14:47:49  joko   *
32  //  + some code from DesignPattern::Bridge   *  Revision 1.6  2003/03/11 02:04:36  joko
33  //   *  + fixed metadata for phpDocumentor
34  //  Revision 1.1  2003/02/03 03:33:48  joko   *
35  //  + initial commit   *  Revision 1.5  2003/03/11 01:42:59  joko
36  //   *  + fixed metadata for phpDocumentor
37  // ---------------------------------------------------------------------------   *
38     *  Revision 1.4  2003/03/11 01:22:24  joko
39     *  + fixed metadata for phpDocumentor
40     *
41     *  Revision 1.3  2003/03/11 01:12:53  joko
42     *  + fixed metadata for phpDocumentor
43     *
44     *  Revision 1.2  2003/03/05 18:54:43  joko
45     *  updated docu - phpDocumentor is very strict about its 'blocks'...
46     *
47     *  Revision 1.1  2003/03/03 21:26:43  joko
48     *  refactored from DesignPattern::Logger
49     *
50     *  Revision 1.4  2003/02/13 00:43:41  joko
51     *  + logfile name now can get passed via defined constant
52     *
53     *  Revision 1.3  2003/02/09 17:14:49  joko
54     *  + now able to redirect errors raised by PEAR to logfile
55     *
56     *  Revision 1.2  2003/02/03 14:47:49  joko
57     *  + some code from DesignPattern::Bridge
58     *
59     *  Revision 1.1  2003/02/03 03:33:48  joko
60     *  + initial commit
61     *
62     * </pre>
63     *
64     */
65    
66    
67  /**  /**
# Line 46  php::loadModule('Class::Abstract'); Line 72  php::loadModule('Class::Abstract');
72    
73    
74  /**  /**
75   * Class::Inner   * --- Class::Inner
76   *   *
77   * @author Andreas Motl <andreas.motl@ilo.de>   * @author Andreas Motl <andreas.motl@ilo.de>
78   * @copyright (c) 2003 - All Rights reserved.   * @copyright (c) 2003 - All Rights reserved.
# Line 55  php::loadModule('Class::Abstract'); Line 81  php::loadModule('Class::Abstract');
81   * @link http://www.netfrag.org/~joko/   * @link http://www.netfrag.org/~joko/
82   * @link http://www.gnu.org/licenses/lgpl.txt   * @link http://www.gnu.org/licenses/lgpl.txt
83   *   *
84     * @package org.netfrag.glib
85   * @subpackage Class   * @subpackage Class
86   * @name Class::Logger   * @name Class::Logger
87   *   *
88     *
89   */   */
90  class Class_Logger extends Class_Abstract {  class Class_Logger extends Class_Abstract {
91    
# Line 88  class Class_Logger extends Class_Abstrac Line 116  class Class_Logger extends Class_Abstrac
116        // TODO: how are these type of errors handled?        // TODO: how are these type of errors handled?
117        //print "error-message: $msg<br>";        //print "error-message: $msg<br>";
118      }      }
119        
120        // TODO: modify this condition: make it more flexible: introduce '$this->ERRORS_STDOUT' or s.th.l.th.
121        //$debug_condition = $this->DEBUG || $level <= PEAR_LOG_WARNING;
122        $debug_condition = $this->DEBUG;
123        //$error_condition = $level <= PEAR_LOG_ERR;
124        $error_condition = $level <= PEAR_LOG_WARNING;
125        
126        $label = 'Unknown'; $color = 'black';
127        if ($debug_condition) { $label = 'Debug'; $color = 'darkgreen'; }
128        if ($error_condition) { $label = 'Error'; $color = 'red'; }
129        
130        $stdout_condition = $level && ($debug_condition || $error_condition);
131        if ($stdout_condition) {
132          // TODO: what now?
133          //user_error($msg);
134          //print "<div><span style=\"color: $color;\"><b>$label</b></span>[$level]: <i>$msg</i></div>";
135          print "<div><span style=\"color: $color;\"><b>$label</b></span>[$level]: $msg</div>";
136        }
137        
138    }    }
139    
140    function _init_logger($logfile, $enable = 0) {    function _init_logger($logfile, $enable = 0) {

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.10

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