Пример #1
0
 /**
  * Short description of method log
  *
  * @access public
  * @author Joel Bout, <*****@*****.**>
  * @param
  *            int level
  * @param
  *            string message
  * @param
  *            array tags
  * @param
  *            string errorFile
  * @param
  *            int errorLine
  * @return mixed
  */
 public function log($level, $message, $tags, $errorFile = '', $errorLine = 0)
 {
     // section 127-0-1-1--5509896f:133feddcac3:-8000:000000000000432A begin
     if ($this->enabled && $this->implementor->getLogThreshold() <= $level) {
         $this->disable();
         $stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
         array_shift($stack);
         // retrieving the user can be a complex procedure, leading to missing log informations
         $user = null;
         if ($errorFile == '') {
             $keys = array_keys($stack);
             $current = $stack[$keys[0]];
             if (isset($current['file']) && isset($current['line'])) {
                 $errorFile = $current['file'];
                 $errorLine = $current['line'];
             }
         }
         if (PHP_SAPI != 'cli') {
             $requestURI = $_SERVER['REQUEST_URI'];
         } else {
             $requestURI = implode(' ', $_SERVER['argv']);
         }
         // reformat input
         if (is_object($message) || is_array($message)) {
             $message = print_r($message, true);
         } else {
             $message = (string) $message;
         }
         if (is_string($tags)) {
             $tags = array($tags);
         }
         $this->implementor->log(new Log\Item($message, $level, time(), $stack, $tags, $requestURI, $errorFile, $errorLine));
         $this->restore();
     }
     // section 127-0-1-1--5509896f:133feddcac3:-8000:000000000000432A end
 }
Пример #2
0
 /**
  * Short description of method addAppender
  *
  * @access public
  * @author Joel Bout, <*****@*****.**>
  * @param  Appender appender
  * @return mixed
  */
 public function addAppender(Appender $appender)
 {
     // section 127-0-1-1--13fe8a1d:134184f8bc0:-8000:0000000000001820 begin
     $this->appenders[] = $appender;
     if (is_null($this->minLevel) || $this->minLevel > $appender->getLogThreshold()) {
         $this->minLevel = $appender->getLogThreshold();
     }
     // section 127-0-1-1--13fe8a1d:134184f8bc0:-8000:0000000000001820 end
 }