当前位置: 首页>>代码示例>>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;未经允许,请勿转载。