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


PHP Logger::getHandlers方法代码示例

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


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

示例1: process

 public function process(AMQPMessage $message)
 {
     $handlers = $this->logger->getHandlers();
     if (empty($handlers)) {
         throw new \Exception('No handlers registered');
     }
     $this->logger->critical($message->body);
     $message->delivery_info['channel']->basic_ack($message->delivery_info['delivery_tag']);
 }
开发者ID:sexlog,项目名称:monolog-telegram-handler,代码行数:9,代码来源:QueueConsumer.php

示例2: testErrorLogHandlerAssertions

 public function testErrorLogHandlerAssertions()
 {
     $handlers = $this->log->getHandlers();
     $hasErrorHandler = false;
     foreach ($handlers as $handler) {
         if (!$handler instanceof ErrorLogHandler) {
             continue;
         }
         $hasErrorHandler = true;
         $this->assertEquals(Logger::ERROR, $handler->getLevel());
     }
     $this->assertTrue($hasErrorHandler);
 }
开发者ID:ebittleman,项目名称:monolog-zf2,代码行数:13,代码来源:MonologTest.php

示例3: testRollbackLogsProfileData

 public function testRollbackLogsProfileData()
 {
     $this->pdo->beginTransaction();
     $this->pdo->rollBack();
     /** @var TestHandler $handler */
     $handlers = $this->logger->getHandlers();
     $handler = $handlers[0];
     $this->assertTrue($handler->hasDebugThatContains('rollBack'));
 }
开发者ID:aaronwebb,项目名称:aura-sql-debug,代码行数:9,代码来源:ExtendedDebugPdoTest.php

示例4: initialize

 /**
  * Initialize
  *
  * Initilize monolog instance. Singleton
  * Is possbile provide an external monolog instance
  *
  * @param \Monolog\Logger
  *
  * @return \Monolog\Logger
  */
 public static function initialize(Logger $external_monolog = null)
 {
     if (self::$monolog === null) {
         if ($external_monolog !== null) {
             self::$monolog = $external_monolog;
             foreach (self::$monolog->getHandlers() as $handler) {
                 if ($handler->getLevel() == 400) {
                     self::$error_log_path = true;
                 }
                 if ($handler->getLevel() == 100) {
                     self::$debug_log_path = true;
                 }
             }
         } else {
             self::$monolog = new Logger('bot_log');
         }
     }
     return self::$monolog;
 }
开发者ID:noplanman,项目名称:php-telegram-bot,代码行数:29,代码来源:TelegramLog.php

示例5: testRecordStructureForException

 public function testRecordStructureForException()
 {
     $pushbullet = Mockery::mock('pushbullet');
     $pushbullet->shouldReceive('user->note')->once();
     $logger = new Logger('MonobulletTest');
     $logger->pushHandler(new Handler($pushbullet, null));
     $logger->info('exception \'ErrorException\' with message \'Undefined property: stdClass::$dummy\' in /tmp/non-existant.php:27' . PHP_EOL . 'Stack trace:' . PHP_EOL . '#0 /tmp/04227d.php(27): HandleExceptions->handleError(8, \'Undefined prope...\', \'/tmp/non-exi...\', 27, Array)' . PHP_EOL . '#1 /tmp/AnotherDummy.php(42): include(\'/tmp/non-exis...\')' . PHP_EOL . '#2 /tmp/WowStillDummy.php(59): Method->DumDum(\'/tmp/che...\', Array)');
     $record = $logger->getHandlers()[0]->getLastRecord();
     $this->assertArrayHasKey('formatted', $record);
     $this->assertArrayHasKey('title', $record['formatted']);
     $this->assertArrayHasKey('stack', $record['formatted']['extra']);
 }
开发者ID:max13,项目名称:monobullet,代码行数:12,代码来源:FormatterTest.php

示例6: getLogger

 /**
  * Get logger.
  *
  * @return null|LoggerInterface
  */
 public function getLogger()
 {
     if (null === $this->logger) {
         $logger = new Logger(Commander::LOGGER_NAME);
         foreach ($this->getHandlers() as $handler) {
             $logger->pushHandler($handler);
         }
         if (0 === count($logger->getHandlers())) {
             return null;
         }
         $this->logger = $logger;
     }
     return $this->logger;
 }
开发者ID:gravitymedia,项目名称:commander,代码行数:19,代码来源:LoggerProvider.php

示例7: testSetHandlers

 /**
  * @covers Monolog\Logger::setHandlers
  */
 public function testSetHandlers()
 {
     $logger = new Logger(__METHOD__);
     $handler1 = new TestHandler();
     $handler2 = new TestHandler();
     $logger->pushHandler($handler1);
     $logger->setHandlers(array($handler2));
     // handler1 has been removed
     $this->assertEquals(array($handler2), $logger->getHandlers());
     $logger->setHandlers(array("AMapKey" => $handler1, "Woop" => $handler2));
     // Keys have been scrubbed
     $this->assertEquals(array($handler1, $handler2), $logger->getHandlers());
 }
开发者ID:saj696,项目名称:pipe,代码行数:16,代码来源:LoggerTest.php

示例8: getHandlers

 /**
  * 
  *
  * @return \Monolog\HandlerInterface[] 
  * @static 
  */
 public static function getHandlers()
 {
     return \Monolog\Logger::getHandlers();
 }
开发者ID:samcrosoft,项目名称:MicroTranslate,代码行数:10,代码来源:lumen_ide_helper.php

示例9: __construct

 /**
  * DynamicLogger constructor.
  */
 public function __construct()
 {
     $this->logger = Log::getMonolog();
     $this->handlers = $this->logger->getHandlers();
 }
开发者ID:rlacerda83,项目名称:laravel-dynamic-logger,代码行数:8,代码来源:DynamicLogger.php

示例10: getLogger

 /**
  * Initialize logging.
  */
 protected function getLogger()
 {
     $logger = new Logger('currycms');
     foreach ($this['log'] as $log) {
         if (isset($log['enabled']) && !$log['enabled']) {
             continue;
         }
         $clazz = new \ReflectionClass($log['type']);
         $arguments = isset($log['arguments']) ? $log['arguments'] : array();
         $handler = $clazz->newInstanceArgs($arguments);
         if (isset($log['buffer']) && $log['buffer']) {
             $handler = new BufferHandler($handler);
         }
         if (isset($log['fingersCrossed']) && $log['fingersCrossed']) {
             $handler = new FingersCrossedHandler($handler);
         }
         $logger->pushHandler($handler);
     }
     if (!count($logger->getHandlers())) {
         $logger->pushHandler(new NullHandler());
     }
     if ($this['developmentMode']) {
         $logger->pushProcessor(new IntrospectionProcessor(Logger::WARNING));
     }
     return $logger;
 }
开发者ID:bombayworks,项目名称:currycms,代码行数:29,代码来源:App.php

示例11: getHandlers

 /**
  * @return \Monolog\Handler\HandlerInterface[]
  */
 public function getHandlers()
 {
     return parent::getHandlers();
 }
开发者ID:akentner,项目名称:incoming-ftp,代码行数:7,代码来源:LoggerProxy.php


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