/**
  * @return StreamLogger
  **/
 protected function publish(LogRecord $record)
 {
     if (!$this->stream) {
         return $this;
     }
     $this->stream->write($record->toString() . "\n");
     return $this;
 }
示例#2
0
 /**
  * @param  string
  * @param  int
  * @return void
  * @throws IOException
  */
 public function publish(LogRecord $rec)
 {
     if (!$this->fd) {
         if (($this->fd = fopen('php://' . $this->pipe, 'w')) === false) {
             throw new IOException('Failed to open output stream on php://' . $this->pipe . ' for writing');
         }
     }
     if (fwrite($this->fd, $rec->toString() . "\n") === false) {
         throw new IOException('Failed to log message');
     }
     # Maybe this is overkill...
     @fflush($this->fd);
 }
示例#3
0
 /**
  * @param  string
  * @param  int
  * @return void
  */
 public function publish(LogRecord $rec)
 {
     if (@error_log($rec->toString(), 3, $this->file) === false) {
         throw new IOException('Failed to log message');
     }
 }