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
 /**
  * Create a reader from a log name
  *
  * @param string $name The name of the log file to read
  * @return sndsgd\log\file\Reader
  */
 public static function createFromName($name)
 {
     $path = LogFile::getPathFromName($name);
     return new self($path);
 }