當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。