Beispiel #1
0
 protected function setUpLogger()
 {
     $formatter = new \Rails\Log\Formatter\Simple();
     $writer = new Zend\Log\Writer\Stream($this->config['paths']['root']->expand('log', $this->config['environment'] . '.log'));
     $writer->setFormatter($formatter);
     $logger = new \Rails\Log\Logger();
     $logger->addWriter($writer);
     $this->services()->setService('log', $logger);
 }
Beispiel #2
0
 private static function defaultLogger()
 {
     $logLevel = (string) self::$config->log_level;
     switch ($logLevel) {
         case '0':
         case 'emergency':
             $level = Zend\Log\Logger::EMERG;
             break;
         case '1':
         case 'alert':
             $level = Zend\Log\Logger::ALERT;
             break;
         case '2':
         case 'critical':
             $level = Zend\Log\Logger::CRIT;
             break;
         case '3':
         case 'error':
             $level = Zend\Log\Logger::ERR;
             break;
         case '4':
         case 'warning':
             $level = Zend\Log\Logger::WARN;
             break;
         case '4':
         case 'notice':
             $level = Zend\Log\Logger::NOTICE;
             break;
         case '5':
         case 'info':
             $level = Zend\Log\Logger::INFO;
             break;
         case '6':
         case 'debug':
             $level = Zend\Log\Logger::DEBUG;
             break;
         default:
             $level = self::$config->log_level;
             break;
     }
     if (false !== $level && null !== $level) {
         $filter = new Zend\Log\Filter\Priority($level);
         $writer->addFilter($filter);
     }
     $formatter = new Rails\Log\Formatter\Simple();
     $writer = new Zend\Log\Writer\Stream(self::$config->log_file);
     $writer->setFormatter($formatter);
     $logger = new Rails\Log\Logger();
     $logger->addWriter($writer);
     return $logger;
 }