| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 | 
							- <?php
 
- /**
 
-  * @file
 
-  * Trivial logger for easier debug.
 
-  */
 
- namespace OSInet\Class_Grapher;
 
- class Logger {
 
-   public $fDebugLevel;
 
-   public function __construct($debugLevel = LOG_WARNING) {
 
-     $this->debugLevel($debugLevel);
 
-   }
 
-   /**
 
-    * Get or Set the current debug level.
 
-    *
 
-    * @param int $level
 
-    *   LOG_EMERG to LOG_DEBUG. If NULL, do not set it.
 
-    *
 
-    * @return
 
-    *   The value of the debug level before this function was called.
 
-    */
 
-   public function debugLevel($level = NULL) {
 
-     $ret = $this->fDebugLevel;
 
-     if (isset($level)) {
 
-       if ($level < LOG_EMERG) {
 
-         $level = LOG_EMERG;
 
-       }
 
-       if ($level > LOG_DEBUG) {
 
-         $level = LOG_DEBUG;
 
-       }
 
-       $this->fDebugLevel = $level;
 
-     }
 
-     return $ret;
 
-   }
 
-   /**
 
-    * Output a message on STDERR if its relevance is above minimum level.
 
-    *
 
-    * @param string $message
 
-    * @param int $level
 
-    *   Defined in RFC 3164, section 4.1.1 "Severity". But compare with Drupal 7
 
-    *   WATCHDOG_* constants in includes/bootstrap.inc for an explanation about
 
-    *   syslog constants in PHP.
 
-    */
 
-   public function debug($message = "\n", $level = LOG_INFO) {
 
-     if ($level <= $this->fDebugLevel) {
 
-       fputs(STDERR, $message);
 
-       fflush(STDERR);
 
-     }
 
-   }
 
- }
 
 
  |