예제 #1
0
 /**
  * {@inheritDoc}
  */
 protected function write(LogEntryInterface $logEntry)
 {
     $ident = $logEntry->getChannel();
     if (!openlog($ident, $this->logopts, $this->facility)) {
         throw new LogicException(Message::get(Message::LOG_SYSLOG_FAIL, $ident, $this->facility), Message::LOG_SYSLOG_FAIL);
     }
     syslog($this->priorities[$logEntry->getLevel()], $logEntry->getFormatted());
 }
예제 #2
0
 /**
  * Execute related handlers on the log entry
  *
  * @param  LogEntryInterface $logEntry
  * @return $this
  * @access protected
  * @since  2.0.1 added level checking here
  */
 protected function runHandlers(LogEntryInterface $logEntry)
 {
     // get related handlers
     $queue = $this->getCallables('handlers', $logEntry->getChannel());
     // loop thru these handlers
     foreach ($queue as $data) {
         // stopped ?
         if ($logEntry->isPropagationStopped()) {
             break;
         }
         // run handler only if level allowed
         if (LogLevel::$levels[$logEntry->getLevel()] >= LogLevel::$levels[$data['extra']]) {
             call_user_func($data['data'], $logEntry);
         }
     }
     return $this;
 }
예제 #3
0
 /**
  * {@inheritDoc}
  */
 protected function format(LogEntryInterface $logEntry)
 {
     $data = ['%datetime%' => date('Y-m-d H:i:s', $logEntry->getTimestamp()), '%level%' => strtoupper($logEntry->getLevel()), '%message%' => $logEntry->getMessage(), '%channel%' => $logEntry->getChannel()];
     return strtr($this->format, $data);
 }