当前位置: 首页>>代码示例>>PHP>>正文


PHP Logger::addStreamLog方法代码示例

本文整理汇总了PHP中Magento\Framework\Logger::addStreamLog方法的典型用法代码示例。如果您正苦于以下问题:PHP Logger::addStreamLog方法的具体用法?PHP Logger::addStreamLog怎么用?PHP Logger::addStreamLog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Framework\Logger的用法示例。


在下文中一共展示了Logger::addStreamLog方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get

 /**
  * Get storage instance
  *
  * @param array $arguments
  * @return \Magento\Store\Model\StoreManagerInterface
  * @throws \InvalidArgumentException
  */
 public function get(array $arguments = array())
 {
     $className = $this->_appState->isInstalled() ? $this->_installedStorageClassName : $this->_defaultStorageClassName;
     if (false == isset($this->_cache[$className])) {
         /** @var $storage \Magento\Store\Model\StoreManagerInterface */
         $storage = $this->_objectManager->create($className, $arguments);
         if (false === $storage instanceof \Magento\Store\Model\StoreManagerInterface) {
             throw new \InvalidArgumentException($className . ' doesn\'t implement \\Magento\\Store\\Model\\StoreManagerInterface');
         }
         $this->_cache[$className] = $storage;
         if ($className === $this->_installedStorageClassName) {
             $this->_reinitStores($storage, $arguments);
             $useSid = $this->_scopeConfig->isSetFlag(\Magento\Framework\Session\SidResolver::XML_PATH_USE_FRONTEND_SID, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storage->getStore());
             $this->_sidResolver->setUseSessionInUrl($useSid);
             $this->_eventManager->dispatch('core_app_init_current_store_after');
             $store = $storage->getStore(true);
             $logActive = $this->_scopeConfig->isSetFlag('dev/log/active', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store);
             if ($logActive || $this->_appState->getMode() === \Magento\Framework\App\State::MODE_DEVELOPER) {
                 $logFile = $this->_scopeConfig->getValue('dev/log/file', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store);
                 $logExceptionFile = $this->_scopeConfig->getValue('dev/log/exception_file', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store);
                 $this->_log->unsetLoggers();
                 $this->_log->addStreamLog(\Magento\Framework\Logger::LOGGER_SYSTEM, $logFile, $this->_writerModel);
                 $this->_log->addStreamLog(\Magento\Framework\Logger::LOGGER_EXCEPTION, $logExceptionFile, $this->_writerModel);
             }
         }
     }
     return $this->_cache[$className];
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:35,代码来源:StorageFactory.php

示例2: testUnsetLoggers

 public function testUnsetLoggers()
 {
     $key = 'test';
     $fileOrWrapper = 'custom_file.log';
     $this->model->addStreamLog($key, $fileOrWrapper);
     $this->assertTrue($this->model->hasLog($key));
     $this->model->unsetLoggers();
     $this->assertFalse($this->model->hasLog($key));
 }
开发者ID:,项目名称:,代码行数:9,代码来源:

示例3: createPackageV1x

 /**
  * Create package file compatible with previous version of Magento Connect Manager
  *
  * @return boolean
  */
 public function createPackageV1x()
 {
     try {
         $this->writeDirectory->create('pear/');
     } catch (\Magento\Framework\Filesystem\FilesystemException $e) {
         $this->logger->addStreamLog(\Magento\Framework\Logger::LOGGER_EXCEPTION);
         $this->logger->log($e->getMessage());
         return false;
     }
     if (!$this->getPackageXml()) {
         $this->generatePackageXml();
     }
     $this->getPackage()->saveV1x($this->writeDirectory->getAbsolutePath('pear/'));
     return true;
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:20,代码来源:Extension.php

示例4: getMenu

 /**
  * Build menu model from config
  *
  * @return \Magento\Backend\Model\Menu
  * @throws \Exception|\InvalidArgumentException
  * @throws \Exception
  * @throws \BadMethodCallException|\Exception
  * @throws \Exception|\OutOfRangeException
  */
 public function getMenu()
 {
     if ($this->_scopeConfig->getValue('dev/log/active', \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) {
         $this->_logger->addStreamLog(\Magento\Backend\Model\Menu::LOGGER_KEY);
     }
     try {
         $this->_initMenu();
         return $this->_menu;
     } catch (\InvalidArgumentException $e) {
         $this->_logger->logException($e);
         throw $e;
     } catch (\BadMethodCallException $e) {
         $this->_logger->logException($e);
         throw $e;
     } catch (\OutOfRangeException $e) {
         $this->_logger->logException($e);
         throw $e;
     } catch (\Exception $e) {
         throw $e;
     }
 }
开发者ID:aiesh,项目名称:magento2,代码行数:30,代码来源:Config.php

示例5: _prepareDestination

 /**
  * Create destination folder if not exists and return full file path
  *
  * @param string $destination
  * @param string $newName
  * @return string
  * @throws \Exception
  */
 protected function _prepareDestination($destination = null, $newName = null)
 {
     if (empty($destination)) {
         $destination = $this->_fileSrcPath;
     } else {
         if (empty($newName)) {
             $info = pathinfo($destination);
             $newName = $info['basename'];
             $destination = $info['dirname'];
         }
     }
     if (empty($newName)) {
         $newFileName = $this->_fileSrcName;
     } else {
         $newFileName = $newName;
     }
     $fileName = $destination . '/' . $newFileName;
     if (!is_writable($destination)) {
         try {
             $this->directoryWrite->create($this->directoryWrite->getRelativePath($destination));
         } catch (\Magento\Framework\Filesystem\FilesystemException $e) {
             $this->logger->addStreamLog(\Magento\Framework\Logger::LOGGER_SYSTEM);
             $this->logger->log($e->getMessage());
             throw new \Exception('Unable to write file into directory ' . $destination . '. Access forbidden.');
         }
     }
     return $fileName;
 }
开发者ID:,项目名称:,代码行数:36,代码来源:

示例6: _validateMergedLayout

 /**
  * Validate merged layout
  *
  * @param string $cacheId
  * @param string $layout
  * @return $this
  */
 protected function _validateMergedLayout($cacheId, $layout)
 {
     $layoutStr = '<handle id="handle">' . $layout . '</handle>';
     if ($this->_appState->getMode() === \Magento\Framework\App\State::MODE_DEVELOPER) {
         if (!$this->_layoutValidator->isValid($layoutStr, Validator::LAYOUT_SCHEMA_MERGED, false)) {
             $messages = $this->_layoutValidator->getMessages();
             //Add first message to exception
             $message = reset($messages);
             $this->_logger->addStreamLog(\Magento\Framework\Logger::LOGGER_SYSTEM);
             $this->_logger->log('Cache file with merged layout: ' . $cacheId . ': ' . $message, \Zend_Log::ERR);
         }
     }
     return $this;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:21,代码来源:Merge.php

示例7: load

 /**
  * Load layout updates by handles
  *
  * @param array|string $handles
  * @throws \Magento\Framework\Exception
  * @return $this
  */
 public function load($handles = array())
 {
     if (is_string($handles)) {
         $handles = array($handles);
     } elseif (!is_array($handles)) {
         throw new \Magento\Framework\Exception('Invalid layout update handle');
     }
     $this->addHandle($handles);
     $cacheId = $this->_getCacheId(md5(implode('|', $this->getHandles())));
     $result = $this->_loadCache($cacheId);
     if ($result) {
         $this->addUpdate($result);
         return $this;
     }
     foreach ($this->getHandles() as $handle) {
         $this->_merge($handle);
     }
     $layout = $this->asString();
     $layoutStr = '<handle id="handle">' . $layout . '</handle>';
     if ($this->_appState->getMode() === \Magento\Framework\App\State::MODE_DEVELOPER) {
         if (!$this->_layoutValidator->isValid($layoutStr, \Magento\Core\Model\Layout\Update\Validator::LAYOUT_SCHEMA_MERGED, false)) {
             $messages = $this->_layoutValidator->getMessages();
             //Add first message to exception
             $message = array_shift($messages);
             $this->_logger->addStreamLog(\Magento\Framework\Logger::LOGGER_SYSTEM);
             $this->_logger->log('Cache file with merged layout: ' . $cacheId . ': ' . $message, \Zend_Log::ERR);
         }
     }
     $this->_saveCache($layout, $cacheId, $this->getHandles());
     return $this;
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:38,代码来源:Merge.php


注:本文中的Magento\Framework\Logger::addStreamLog方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。