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


PHP Logger::getHierarchy方法代码示例

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


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

示例1: testAddRenderer

 public function testAddRenderer()
 {
     $hierarchy = Logger::getHierarchy();
     //print_r($hierarchy);
     LoggerRendererMap::addRenderer($hierarchy, 'string', 'LoggerRendererDefault');
     //print_r($hierarchy);
     self::markTestIncomplete();
 }
开发者ID:AnvilStriker,项目名称:owasp-esapi-php,代码行数:8,代码来源:LoggerRendererMapTest.php

示例2: testGetByClassName

 public function testGetByClassName()
 {
     Logger::configure(dirname(__FILE__) . '/test4.properties');
     $hierarchy = Logger::getHierarchy();
     $map = $hierarchy->getRendererMap();
     $e = $map->getByClassName('Fruit3');
     self::assertTrue($e instanceof FruitRenderer3);
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:8,代码来源:LoggerRendererMapTest.php

示例3: getStringRepresentation

 /**
  * @desc Returns string representation of throwable
  * 
  * @return array 
  */
 public function getStringRepresentation()
 {
     if (!is_array($this->throwableArray)) {
         $renderer = Logger::getHierarchy()->getRendererMap()->getByClassName(get_class($this->throwable));
         // TODO: why this?
         if ($renderer instanceof LoggerRendererDefault) {
             $renderer = new LoggerRendererException();
         }
         $this->throwableArray = explode("\n", $renderer->render($this->throwable));
     }
     return $this->throwableArray;
 }
开发者ID:haitao1880,项目名称:study,代码行数:17,代码来源:LoggerThrowableInformation.php

示例4: testGetLocationInformation

 public function testGetLocationInformation()
 {
     $hierarchy = Logger::getHierarchy();
     $root = $hierarchy->getRootLogger();
     $a = new LoggerLoggingEventTestCaseAppender('A1');
     $a->setLayout(new LoggerLoggingEventTestCaseLayout());
     $root->addAppender($a);
     $logger = $hierarchy->getLogger('test');
     $line = __LINE__;
     $logger->debug('test');
     $hierarchy->shutdown();
     $li = self::$locationInfo;
     self::assertEquals($li->getClassName(), get_class($this));
     self::assertEquals($li->getFileName(), __FILE__);
     self::assertEquals($li->getLineNumber(), $line);
     self::assertEquals($li->getMethodName(), __FUNCTION__);
 }
开发者ID:AnvilStriker,项目名称:owasp-esapi-php,代码行数:17,代码来源:LoggerLoggingEventTest.php

示例5: testThreshold

 public function testThreshold()
 {
     Logger::configure(array('threshold' => 'WARN', 'rootLogger' => array('appenders' => array('default')), 'appenders' => array('default' => array('class' => 'LoggerAppenderEcho'))));
     $actual = Logger::getHierarchy()->getThreshold();
     $expected = LoggerLevel::getLevelWarn();
     self::assertSame($expected, $actual);
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:7,代码来源:LoggerConfiguratorTest.php

示例6: testGetThrowableInformation2

 public function testGetThrowableInformation2()
 {
     $hierarchy = Logger::getHierarchy();
     $root = $hierarchy->getRootLogger();
     $a = new LoggerLoggingEventTestCaseAppender('A1');
     $a->setLayout(new LoggerLoggingEventTestCaseLayout());
     $root->addAppender($a);
     $ex = new Exception('Message1');
     $logger = $hierarchy->getLogger('test');
     $logger->debug('test', $ex);
     $hierarchy->shutdown();
     $ti = self::$throwableInfo;
     self::assertTrue($ti instanceof LoggerThrowableInformation);
     $result = $ti->getStringRepresentation();
     self::assertInternalType('array', $result);
 }
开发者ID:keehao,项目名称:Php-Object-Framework,代码行数:16,代码来源:LoggerLoggingEventTest.php

示例7: getRenderedMessage

 /**
  * Render message.
  * @return string
  */
 public function getRenderedMessage()
 {
     if ($this->renderedMessage === null and $this->message !== null) {
         if (is_string($this->message)) {
             $this->renderedMessage = $this->message;
         } else {
             $rendererMap = Logger::getHierarchy()->getRendererMap();
             $this->renderedMessage = $rendererMap->findAndRender($this->message);
         }
     }
     return $this->renderedMessage;
 }
开发者ID:cdkisa,项目名称:majordomo,代码行数:16,代码来源:LoggerLoggingEvent.php

示例8: getRenderedMessage

 /**
  * Render message.
  * @return string
  */
 public function getRenderedMessage()
 {
     if ($this->renderedMessage === null and $this->message !== null) {
         if (is_string($this->message)) {
             $this->renderedMessage = $this->message;
         } else {
             // $this->logger might be null or an instance of Logger or RootLogger
             // But in contrast to log4j, in log4php there is only have one LoggerHierarchy so there is
             // no need figure out which one is $this->logger part of.
             // TODO: Logger::getHierarchy() is marked @deprecated!
             $repository = Logger::getHierarchy();
             $rendererMap = $repository->getRendererMap();
             $this->renderedMessage = $rendererMap->findAndRender($this->message);
         }
     }
     return $this->renderedMessage;
 }
开发者ID:haitao1880,项目名称:study,代码行数:21,代码来源:LoggerLoggingEvent.php

示例9: testRenderer

 public function testRenderer()
 {
     Logger::configure('configurators/test4.properties');
     Logger::initialize();
     $hierarchy = Logger::getHierarchy();
     $map = $hierarchy->getRendererMap();
     $clazz = $map->getByClassName('Fruit');
     self::assertTrue($clazz instanceof FruitRenderer);
 }
开发者ID:sacredwebsite,项目名称:scalr,代码行数:9,代码来源:LoggerConfiguratorIniTest.php

示例10: testXMLConfig

 public function testXMLConfig()
 {
     $map = Logger::getHierarchy()->getRendererMap();
     Logger::resetConfiguration();
     self::assertInstanceOf('LoggerRendererDefault', $map->getDefaultRenderer());
     Logger::configure(PHPUNIT_CONFIG_DIR . '/renderers/config_default_renderer.xml');
     self::assertInstanceOf('FruitRenderer3', $map->getDefaultRenderer());
     Logger::resetConfiguration();
     self::assertInstanceOf('LoggerRendererDefault', $map->getDefaultRenderer());
 }
开发者ID:keehao,项目名称:Php-Object-Framework,代码行数:10,代码来源:LoggerRendererMapTest.php

示例11: testThreshold

 public function testThreshold()
 {
     Logger::configure('configurators/test1.xml');
     $root = Logger::getRootLogger();
     self::assertEquals(LoggerLevel::getLevelWarn(), $root->getLevel());
     $appender = $root->getAppender("default");
     self::assertTrue($appender instanceof LoggerAppenderEcho);
     $layout = $appender->getLayout();
     self::assertTrue($layout instanceof LoggerLayoutSimple);
     $threshold = $appender->getThreshold();
     self::assertTrue($threshold instanceof LoggerLevel);
     $e = LoggerLevel::getLevelWarn();
     self::assertEquals($e, $threshold);
     $appender = $root->getAppender("blub");
     self::assertTrue($appender instanceof LoggerAppenderEcho);
     $layout = $appender->getLayout();
     self::assertTrue($layout instanceof LoggerLayoutSimple);
     $threshold = $appender->getThreshold();
     self::assertTrue($threshold instanceof LoggerLevel);
     $e = LoggerLevel::getLevelInfo();
     self::assertEquals($e, $threshold);
     $filter = $appender->getFilter();
     self::assertTrue($filter instanceof LoggerFilterLevelRange);
     $filter2 = $filter->getNext();
     self::assertTrue($filter2 instanceof LoggerFilterDenyAll);
     $threshold = Logger::getHierarchy()->getThreshold();
     self::assertTrue($threshold instanceof LoggerLevel);
     $e = LoggerLevel::getLevelWarn();
     self::assertEquals($e, $threshold);
     $hierarchy = Logger::getHierarchy();
     $map = $hierarchy->getRendererMap();
     $clazz = $map->getByClassName('Fruit2');
     self::assertTrue($clazz instanceof FruitRenderer2);
 }
开发者ID:sacredwebsite,项目名称:scalr,代码行数:34,代码来源:LoggerConfiguratorXmlTest.php


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