當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Logger::unsetLoggers方法代碼示例

本文整理匯總了PHP中Magento\Framework\Logger::unsetLoggers方法的典型用法代碼示例。如果您正苦於以下問題:PHP Logger::unsetLoggers方法的具體用法?PHP Logger::unsetLoggers怎麽用?PHP Logger::unsetLoggers使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Framework\Logger的用法示例。


在下文中一共展示了Logger::unsetLoggers方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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,代碼來源:


注:本文中的Magento\Framework\Logger::unsetLoggers方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。