Example #1
0
 /**
  * {@inheritdoc}
  */
 public function write()
 {
     $path = LogFile::getPathFromName($this->record->getName());
     if (($test = File::prepare($path, 0775)) !== true) {
         throw new Exception("failed to write log file '{$path}'; {$test}");
     }
     $line = LogFile::encodeRecord($this->record);
     if (!@file_put_contents($path, "{$line}\n", FILE_APPEND)) {
         throw new Exception("failed to write log '{$path}': {$line}");
     }
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function read()
 {
     if (feof($this->fh) || ($line = fgets($this->fh)) === false) {
         return null;
     }
     return LogFile::decodeRecord($line);
 }