Example #1
0
 /**
  * Constructs a new Log_file object.
  *
  * @param string $name     Ignored.
  * @param string $ident    The identity string.
  * @param array  $conf     The configuration array.
  * @param array  $maxLevel Maximum priority level at which to log.
  * @access public
  */
 function epLib_Log_file($name, $ident = '', $conf = array(), $maxLevel = PEAR_LOG_DEBUG)
 {
     $this->_id = md5(microtime());
     $this->_filename = $name;
     $this->_ident = $ident;
     //$this->_mask = Log::UPTO($maxLevel);
     $this->_mask = epLib_Log::UPTO($maxLevel);
     if (isset($conf['append'])) {
         $this->_append = $conf['append'];
     }
     if (!empty($conf['mode'])) {
         $this->_mode = $conf['mode'];
     }
     if (!empty($conf['lineFormat'])) {
         $this->_lineFormat = str_replace(array_keys($this->_formatMap), array_values($this->_formatMap), $conf['lineFormat']);
     }
     if (!empty($conf['timeFormat'])) {
         $this->_timeFormat = $conf['timeFormat'];
     }
     if (!empty($conf['eol'])) {
         $this->_eol = $conf['eol'];
     } else {
         $this->_eol = strstr(PHP_OS, 'WIN') ? "\r\n" : "\n";
     }
     register_shutdown_function(array(&$this, '_Log_file'));
 }
Example #2
0
 function epLibLog_console($name, $ident = '', $conf = array(), $maxLevel = PEAR_LOG_DEBUG)
 {
     $this->_id = md5(microtime());
     $this->_ident = $ident;
     //$this->_mask = Log::UPTO($maxLevel);
     $this->_mask = epLib_Log::UPTO($maxLevel);
     if (!empty($conf['stream'])) {
         $this->_stream = $conf['stream'];
     }
     if (isset($conf['buffering'])) {
         $this->_buffering = $conf['buffering'];
     }
     if (!empty($conf['lineFormat'])) {
         $this->_lineFormat = str_replace(array_keys($this->_formatMap), array_values($this->_formatMap), $conf['lineFormat']);
     }
     if (!empty($conf['timeFormat'])) {
         $this->_timeFormat = $conf['timeFormat'];
     }
     /*
      * If output buffering has been requested, we need to register a
      * shutdown function that will dump the buffer upon termination.
      */
     if ($this->_buffering) {
         register_shutdown_function(array(&$this, '_Log_console'));
     }
 }