Преглед изворни кода

Remove exchangeName usage for AMQP extension users and make PhpAmqpLib use it only if provided, no more default to "log", fixes #355

Jordi Boggiano пре 9 година
родитељ
комит
b9bf56a330
1 измењених фајлова са 3 додато и 5 уклоњено
  1. 3 5
      src/Monolog/Handler/AmqpHandler.php

+ 3 - 5
src/Monolog/Handler/AmqpHandler.php

@@ -32,15 +32,13 @@ class AmqpHandler extends AbstractProcessingHandler
 
 
     /**
     /**
      * @param AMQPExchange|AMQPChannel $exchange     AMQPExchange (php AMQP ext) or PHP AMQP lib channel, ready for use
      * @param AMQPExchange|AMQPChannel $exchange     AMQPExchange (php AMQP ext) or PHP AMQP lib channel, ready for use
-     * @param string                   $exchangeName
+     * @param string                   $exchangeName Optional exchange name, for AMQPChannel (PhpAmqpLib) only
      * @param int                      $level
      * @param int                      $level
      * @param bool                     $bubble       Whether the messages that are handled can bubble up the stack or not
      * @param bool                     $bubble       Whether the messages that are handled can bubble up the stack or not
      */
      */
-    public function __construct($exchange, $exchangeName = 'log', $level = Logger::DEBUG, $bubble = true)
+    public function __construct($exchange, $exchangeName = null, $level = Logger::DEBUG, $bubble = true)
     {
     {
-        if ($exchange instanceof AMQPExchange) {
-            $exchange->setName($exchangeName);
-        } elseif ($exchange instanceof AMQPChannel) {
+        if ($exchange instanceof AMQPChannel) {
             $this->exchangeName = $exchangeName;
             $this->exchangeName = $exchangeName;
         } else {
         } else {
             throw new \InvalidArgumentException('PhpAmqpLib\Channel\AMQPChannel or AMQPExchange instance required');
             throw new \InvalidArgumentException('PhpAmqpLib\Channel\AMQPChannel or AMQPExchange instance required');