16use PhpAmqpLib\Message\AMQPMessage;
17use PhpAmqpLib\Channel\AMQPChannel;
42 } elseif (
$exchange instanceof AMQPChannel) {
45 throw new \InvalidArgumentException(
'PhpAmqpLib\Channel\AMQPChannel or AMQPExchange instance required');
55 protected function write(array $record)
57 $data = $record[
"formatted"];
60 if ($this->exchange instanceof AMQPExchange) {
61 $this->exchange->publish(
67 'content_type' =>
'application/json',
71 $this->exchange->basic_publish(
84 if ($this->exchange instanceof AMQPExchange) {
98 $this->exchange->batch_basic_publish(
105 $this->exchange->publish_batch();
116 $routingKey = sprintf(
119 substr($record[
'level_name'], 0, 4),
123 return strtolower($routingKey);
132 return new AMQPMessage(
135 'delivery_mode' => 2,
136 'content_type' =>
'application/json',
An exception for terminatinating execution or to throw for unit testing.
getFormatter()
{Gets the formatter.FormatterInterface}
isHandling(array $record)
{Checks whether the given record will be handled by this handler.This is mostly done for performance ...
Base Handler class providing the Handler structure.
processRecord(array $record)
Processes a record.
handleBatch(array $records)
{Handles a set of records at once.}
write(array $record)
Writes the record down to the log of the implementing handler.void
__construct($exchange, $exchangeName='log', $level=Logger::DEBUG, $bubble=true)
getRoutingKey(array $record)
Gets the routing key for the AMQP exchange.
getDefaultFormatter()
Gets the default formatter.FormatterInterface
const DEBUG
Detailed debug information.