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


PHP Logger::addPriority方法代码示例

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


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

示例1: testAddLogPriority

 public function testAddLogPriority()
 {
     $logger = new Logger($this->writer);
     $logger->addPriority('EIGHT', $priority = 8);
     $logger->eight($message = 'eight message');
     rewind($this->log);
     $logdata = stream_get_contents($this->log);
     $this->assertContains((string) $priority, $logdata);
     $this->assertContains($message, $logdata);
 }
开发者ID:bradley-holt,项目名称:zf2,代码行数:10,代码来源:LoggerTest.php

示例2: testPriorityDuplicates

 /**
  * @group ZF-10170
  */
 public function testPriorityDuplicates()
 {
     $logger = new Logger();
     $mock = new Log\Writer\Mock();
     $logger->addWriter($mock);
     try {
         $logger->addPriority('emerg', 8);
         $this->fail();
     } catch (\Exception $e) {
         $this->assertType('Zend\\Log\\Exception', $e);
         $this->assertEquals('Existing priorities cannot be overwritten', $e->getMessage());
     }
     try {
         $logger->log('zf10170', 0);
         $logger->log('clone zf10170', 8);
         $this->fail();
     } catch (\Exception $e) {
         $this->assertType('Zend\\Log\\Exception', $e);
         $this->assertEquals('Bad log priority', $e->getMessage());
     }
     $this->assertEquals(0, $mock->events[0]['priority']);
     $this->assertEquals('EMERG', $mock->events[0]['priorityName']);
     $this->assertFalse(array_key_exists(1, $mock->events));
 }
开发者ID:heiglandreas,项目名称:zf2,代码行数:27,代码来源:LoggerTest.php

示例3: testExceptionIsThrownOnPriorityDuplicates

 /**
  * @group ZF-10170
  */
 public function testExceptionIsThrownOnPriorityDuplicates()
 {
     $logger = new Logger();
     $mock = new Log\Writer\Mock();
     $logger->addWriter($mock);
     $this->setExpectedException('Zend\\Log\\Exception\\InvalidArgumentException', 'Existing priorities cannot be overwritten');
     $logger->addPriority('emerg', 8);
 }
开发者ID:rexmac,项目名称:zf2,代码行数:11,代码来源:LoggerTest.php


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