예제 #1
0
 /**
  * {@inheritDoc}
  */
 public function __invoke(LogEntryInterface $log)
 {
     // open syslog
     if (!openlog($this->ident, $this->options, $this->facility)) {
         throw new Exception\InvalidArgumentException(Message::get(Message::INVALID_LOG_SYSLOG, $this->ident, $this->facility), Message::INVALID_LOG_SYSLOG);
     }
     // write syslog
     syslog($this->map[$log->getLevel()], call_user_func($this->getFormatter(), $log));
     // close syslog
     closelog();
 }
예제 #2
0
 /**
  * {@inheritDoc}
  */
 public function __invoke(LogEntryInterface $log)
 {
     $data = ['%datetime%' => date('Y-m-d H:i:s', $log->getTimestamp()), '%channel%' => $log->getContext('__CHANNEL__'), '%level_name%' => strtoupper($log->getLevel()), '%message%' => $log->getMessage(), '%context%' => $this->printContext($log->getContexts())];
     return strtr($this->format, $data);
 }