Пример #1
0
 /**
  * Log wrapper
  *
  * @param string $message
  * @param int $level
  * @param string $file
  * @param bool $forceLog
  * @return void
  */
 public function log($message, $level = null, $file = '', $forceLog = false)
 {
     if (empty($file)) {
         $file = self::MENU_DEBUG_FILE;
     }
     parent::log($message, $level, $file, $forceLog);
 }
Пример #2
0
 public function testLogComplex()
 {
     $this->expectOutputRegex('/Array\\s\\(\\s+\\[0\\] => 1\\s\\).+stdClass Object/s');
     $this->_model->addStreamLog(Mage_Core_Model_Logger::LOGGER_SYSTEM, 'php://output');
     $this->_model->log(array(1));
     $this->_model->log(new StdClass());
 }
Пример #3
0
 /**
  * Save file to storage
  *
  * @param string $filePath
  * @param string $content
  * @param bool $overwrite
  * @return bool
  */
 public function saveFile($filePath, $content, $overwrite = false)
 {
     if (strpos($filePath, $this->getMediaBaseDirectory()) !== 0) {
         $filePath = $this->getMediaBaseDirectory() . DS . $filePath;
     }
     try {
         if (!$this->_filesystem->isFile($filePath) || $overwrite && $this->_filesystem->delete($filePath)) {
             $this->_filesystem->write($filePath, $content);
             return true;
         }
     } catch (Magento_Filesystem_Exception $e) {
         $this->_logger->log($e->getMessage());
         Mage::throwException($this->_helper->__('Unable to save file: %s', $filePath));
     }
     return false;
 }