示例#1
0
 /**
  * {@inheritdoc}
  */
 public function update(SubjectInterface $subject, $arguments = null)
 {
     // Check instance
     if (!$arguments instanceof LogRecord) {
         return;
     }
     // Create file
     $file = new File($this->path . DIRECTORY_SEPARATOR . strtolower($arguments->getLevel()) . static::DEFAULT_EXTENSION);
     // Append message
     $file->append((new \DateTime())->format('Y-m-d H:i:s') . ' - ' . $arguments->getMessage() . PHP_EOL);
 }
示例#2
0
 /**
  * Returns true if the settings file is succesfully saved at the given location.
  *
  * @param $path = self::DEFAULT_FILENAME
  * @return bool true if the settings file is succesfully saved at the given location.
  */
 public function save($path = self::DEFAULT_FILENAME)
 {
     // Init
     $file = new File($path);
     // Save data
     return $file->write(json_encode($this->data));
 }