1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-08 06:06:40 +02:00

Cosmetic fixes

This commit is contained in:
Jordi Boggiano
2012-06-19 22:15:10 +02:00
parent efa37359df
commit 89b5a3caac
3 changed files with 42 additions and 39 deletions

View File

@@ -106,14 +106,13 @@ Handlers
[Mongo](http://pecl.php.net/package/mongo) extension connection. [Mongo](http://pecl.php.net/package/mongo) extension connection.
- _NativeMailHandler_: Sends emails using PHP's - _NativeMailHandler_: Sends emails using PHP's
[`mail()`](http://php.net/manual/en/function.mail.php) function. [`mail()`](http://php.net/manual/en/function.mail.php) function.
- _SwiftMailerHandler_: Sends emails using a `Swift_Mailer` instance. - _SwiftMailerHandler_: Sends emails using a [`Swift_Mailer`](http://swiftmailer.org/) instance.
- _SyslogHandler_: Logs records to the syslog. - _SyslogHandler_: Logs records to the syslog.
- _GelfHandler_: Logs records to a [Graylog2](http://www.graylog2.org) server. - _GelfHandler_: Logs records to a [Graylog2](http://www.graylog2.org) server.
- _SocketHandler_: Logs records to [sockets](http://php.net/fsockopen), use this - _SocketHandler_: Logs records to [sockets](http://php.net/fsockopen), use this
for UNIX and TCP sockets. See an [example](https://github.com/Seldaek/monolog/blob/master/doc/sockets.md). for UNIX and TCP sockets. See an [example](https://github.com/Seldaek/monolog/blob/master/doc/sockets.md).
- _AmqpHandler_L Logs records using [amqp](php.net/manual/en/book.amqp.php) protocol to the RabbitMQ server. - _AmqpHandler_: Logs records to an [amqp](http://www.amqp.org/) compatible
Note: handler needs an installed amqp version > 1. server. Requires the [php-amqp](http://pecl.php.net/package/amqp) extension (1.0+).
For instructions on installation look in (http://lv.php.net/manual/en/amqp.installation.php)
Wrappers / Special Handlers Wrappers / Special Handlers
--------------------------- ---------------------------
@@ -164,7 +163,6 @@ Requirements
- Any flavor of PHP 5.3 should do - Any flavor of PHP 5.3 should do
- [optional] PHPUnit 3.5+ to execute the test suite (phpunit --version) - [optional] PHPUnit 3.5+ to execute the test suite (phpunit --version)
- [optional] installed amqp library to use AmqpHandler.
Submitting bugs and feature requests Submitting bugs and feature requests
------------------------------------ ------------------------------------

View File

@@ -19,7 +19,9 @@
"mlehner/gelf-php": "1.0.*" "mlehner/gelf-php": "1.0.*"
}, },
"suggest": { "suggest": {
"mlehner/gelf-php": "Allow sending log messages to a GrayLog2 server" "mlehner/gelf-php": "Allow sending log messages to a GrayLog2 server",
"ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
"ext-mongo": "Allow sending log messages to a MongoDB server"
}, },
"autoload": { "autoload": {
"psr-0": {"Monolog": "src/"} "psr-0": {"Monolog": "src/"}

View File

@@ -24,7 +24,7 @@ class AmqpHandler extends AbstractProcessingHandler
/** /**
* @param \AMQPExchange $exchange AMQP exchange, ready for use * @param \AMQPExchange $exchange AMQP exchange, ready for use
* @param string $exchangeName * @param string $exchangeName
* @param string $issuer isser name * @param string $issuer issuer name
* @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
*/ */
@@ -43,18 +43,21 @@ class AmqpHandler extends AbstractProcessingHandler
{ {
$data = $record["formatted"]; $data = $record["formatted"];
$routingKey = sprintf('%s.%s', $routingKey = sprintf(
'%s.%s',
substr($record['level_name'], 0, 4), substr($record['level_name'], 0, 4),
$record['channel']); $record['channel']
);
//we do not check return value because no handler really does $this->exchange->publish(
$this->exchange->publish($data, $data,
strtolower($routingKey), strtolower($routingKey),
0, 0,
array( array(
'delivery_mode' => 2, 'delivery_mode' => 2,
'Content-type' => 'application/json' 'Content-type' => 'application/json'
)); )
);
} }
/** /**