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


PHP Logger::getName方法代码示例

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


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

示例1: testConstruct

 public function testConstruct()
 {
     $root = new Logger('root');
     $logger = new Logger('logger', $root);
     $this->assertEquals('logger', $logger->getName());
     $this->assertTrue($root === $logger->getParent());
     $this->assertEquals(array(), $logger->getAppenders());
     $this->assertTrue($logger->getAddictive());
 }
开发者ID:mougrim,项目名称:php-logger-old-interface,代码行数:9,代码来源:LoggerTest.php

示例2: testGetSetName

 public function testGetSetName()
 {
     // Using method
     $logger = new Logger();
     $logger->setName('logger1');
     $this->assertEquals('logger1', $logger->getName());
     // Using constructor
     $logger2 = new Logger(null, 'logger2');
     $this->assertEquals('logger2', $logger2->getName());
 }
开发者ID:onesimus-systems,项目名称:oslogger,代码行数:10,代码来源:LoggerTest.php

示例3: test_constructor_Monolog

 public function test_constructor_Monolog()
 {
     $log = new Logger();
     $this->assertTrue($log instanceof Logger);
     $this->assertEquals(Logger::DEFAULT_LOGGER_NAME, $log->getName());
     $this->assertTrue($log->isMonologLogger());
     $logTest = Logger::instance('test');
     $this->assertEquals('test', $logTest->getName());
     $this->assertTrue($log->isMonologLogger());
     $logMage = Logger::instance('magento', 'some/file/that/is/not/exist');
     $this->assertEquals('magento', $logMage->getName());
     $this->assertFalse($logMage->isMonologLogger());
 }
开发者ID:praxigento,项目名称:mage_ext_logging,代码行数:13,代码来源:Logger_Test.php

示例4: toString

 /**
  * String representation of this log record
  * 
  * @return string
  */
 public function toString()
 {
     // Date & Level
     $msg = '[' . $this->getTimeFormat() . ' ' . $this->getLevelName();
     // Name
     if ($this->logger->getDisplaysName()) {
         $msg .= ' ' . $this->logger->getName();
     }
     $msg .= '] ';
     // Message
     if ($this->message) {
         $msg .= $this->message . ' ';
     }
     if ($this->thrown) {
         $msg .= ABException::format($this->thrown, true, false);
     }
     return "{$msg}";
 }
开发者ID:rsms,项目名称:phpab,代码行数:23,代码来源:LogRecord.php

示例5: printHierarchyInner

 private function printHierarchyInner(Logger $current, $level)
 {
     for ($i = 0; $i < $level; $i++) {
         echo $i == $level - 1 ? "|--" : "|  ";
     }
     echo $current->getName() . "\n";
     foreach ($this->loggers as $logger) {
         if ($logger->getParent() == $current) {
             $this->printHierarchyInner($logger, $level + 1);
         }
     }
 }
开发者ID:jjaferson,项目名称:ourives,代码行数:12,代码来源:LoggerHierarchy.php

示例6: setProcessorsForLogger

 /**
  * Appends the processors to the given logger as configured.
  *
  * @param \TYPO3\CMS\Core\Log\Logger $logger Logger to configure
  * @return void
  */
 protected function setProcessorsForLogger(Logger $logger)
 {
     $configuration = $this->getConfigurationForLogger(self::CONFIGURATION_TYPE_PROCESSOR, $logger->getName());
     foreach ($configuration as $severityLevel => $processor) {
         foreach ($processor as $logProcessorClassName => $logProcessorOptions) {
             /** @var $logProcessor \TYPO3\CMS\Core\Log\Processor\ProcessorInterface */
             $logProcessor = NULL;
             try {
                 $logProcessor = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($logProcessorClassName, $logProcessorOptions);
                 $logger->addProcessor($severityLevel, $logProcessor);
             } catch (\Psr\Log\InvalidArgumentException $e) {
                 $logger->warning('Instantiation of LogProcessor "' . $logProcessorClassName . '" failed for logger ' . $logger->getName() . ' (' . $e->getMessage() . ')');
             } catch (\TYPO3\CMS\Core\Log\Exception\InvalidLogProcessorConfigurationException $e) {
                 $logger->warning('Instantiation of LogProcessor "' . $logProcessorClassName . '" failed for logger ' . $logger->getName() . ' (' . $e->getMessage() . ')');
             }
         }
     }
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:24,代码来源:LogManager.php

示例7: testGetName

 /**
  * @return void
  */
 public function testGetName()
 {
     $someName = 'Some name';
     $logger = new Logger($someName);
     $this->assertEquals($someName, $logger->getName());
 }
开发者ID:Mohitsahu123,项目名称:data-migration-tool-ce,代码行数:9,代码来源:LoggerTest.php

示例8: configureLogger

 /**
  * Configures a logger. 
  * 
  * @param Logger $logger The logger to configure
  * @param array $config Logger configuration options.
  */
 private function configureLogger(Logger $logger, $config)
 {
     $loggerName = $logger->getName();
     // Set logger level
     if (isset($config['level'])) {
         $level = LoggerLevel::toLevel($config['level']);
         if (isset($level)) {
             $logger->setLevel($level);
         } else {
             $default = $logger->getLevel();
             $this->warn("Invalid level value [{$config['level']}] specified for logger [{$loggerName}]. Ignoring level definition.");
         }
     }
     // Link appenders to logger
     if (isset($config['appenders'])) {
         foreach ($config['appenders'] as $appenderName) {
             if (isset($this->appenders[$appenderName])) {
                 $logger->addAppender($this->appenders[$appenderName]);
             } else {
                 $this->warn("Nonexistnant appender [{$appenderName}] linked to logger [{$loggerName}].");
             }
         }
     }
     // Set logger additivity
     if (isset($config['additivity'])) {
         $additivity = LoggerOptionConverter::toBoolean($config['additivity'], null);
         if (is_bool($additivity)) {
             $logger->setAdditivity($additivity);
         } else {
             $this->warn("Invalid additivity value [{$config['additivity']}] specified for logger [{$loggerName}]. Ignoring additivity setting.");
         }
     }
 }
开发者ID:NetworkCedu,项目名称:saigon,代码行数:39,代码来源:LoggerConfiguratorDefault.php


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