diff --git a/pharIt.php b/pharIt.php new file mode 100644 index 00000000..5581328a --- /dev/null +++ b/pharIt.php @@ -0,0 +1,28 @@ +#!/usr/bin/env php +setSignatureAlgorithm(Phar::SHA1); + +$phar->startBuffering(); + +$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(__DIR__.'/src/Monolog', FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST); +foreach ($files as $file) { + if (false !== strpos($file->getRealPath(), '.git')) { + continue; + } + + $path = str_replace(realpath(__DIR__).'/', '', $file->getRealPath()); + $phar->addFile($file->getRealPath(), $path); + + echo "$path\n"; +} + +$phar->addFile('src/Monolog/Logger.php'); + +$phar->setDefaultStub('src/Monolog/Logger.php', 'Logger.php'); + +$phar->stopBuffering(); +$phar->compressFiles(Phar::GZ); + +unset($phar); \ No newline at end of file diff --git a/src/Monolog/Handler/AmqpHandler.php b/src/Monolog/Handler/AmqpHandler.php index 13c7351c..f34e11b4 100644 --- a/src/Monolog/Handler/AmqpHandler.php +++ b/src/Monolog/Handler/AmqpHandler.php @@ -21,12 +21,6 @@ class AmqpHandler extends AbstractProcessingHandler */ protected $exchange; - /** - * Describes current issuer (e.g. "database", "landing", "server" and so on) - * @var string $issuer - */ - protected $issuer; - /** * @param \AMQPExchange $exchange AMQP exchange, ready for use * @param string $exchangeName @@ -34,9 +28,8 @@ class AmqpHandler extends AbstractProcessingHandler * @param int $level * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ - public function __construct(\AMQPExchange $exchange, $exchangeName = 'log', $issuer = 'default', $level = Logger::DEBUG, $bubble = true) + public function __construct(\AMQPExchange $exchange, $exchangeName = 'log', $level = Logger::DEBUG, $bubble = true) { - $this->issuer = $issuer; $this->exchange = $exchange; $this->exchange->setName($exchangeName); @@ -55,7 +48,7 @@ class AmqpHandler extends AbstractProcessingHandler $routingKey = sprintf('%s.%s', substr($record['level_name'], 0, 4), - $this->getIssuer()); + $record['channel']); //we do not check return value because no handler really does $this->exchange->publish($data, @@ -74,22 +67,4 @@ class AmqpHandler extends AbstractProcessingHandler { return new JsonFormatter(); } - - /** - * Issuer setter - * @param string $issuer - */ - public function setIssuer($issuer) - { - $this->issuer = $issuer; - } - - /** - * Issuer getter - * @return string - */ - public function getIssuer() - { - return $this->issuer; - } } diff --git a/tests/Monolog/Handler/AmqpHandlerTest.php b/tests/Monolog/Handler/AmqpHandlerTest.php index e0b11fc5..780624da 100644 --- a/tests/Monolog/Handler/AmqpHandlerTest.php +++ b/tests/Monolog/Handler/AmqpHandlerTest.php @@ -34,7 +34,7 @@ class AmqpHandlerTest extends TestCase { $exchange = $this->getExchange(); - $handler = new AmqpHandler($exchange, 'log', 'test'); + $handler = new AmqpHandler($exchange, 'log'); $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34));