Permalink
Browse files

CS fixes

  • Loading branch information...
1 parent 6588c16 commit 9c8db383855f4f42ace257b0fdb0450386834902 @Seldaek committed Dec 14, 2012
View
@@ -147,7 +147,7 @@ Formatters
- _WildfireFormatter_: Used to format log records into the Wildfire/FirePHP protocol, only useful for the FirePHPHandler.
- _ChromePHPFormatter_: Used to format log records into the ChromePHP format, only useful for the ChromePHPHandler.
- _GelfFormatter_: Used to format log records into Gelf message instances, only useful for the GelfHandler.
-- _LogstashEventFormatter_: Used to format log records into [logstash](http://logstash.net/) event json, useful for any handler listed under inputs [here](http://logstash.net/docs/1.1.1/).
+- _LogstashFormatter_: Used to format log records into [logstash](http://logstash.net/) event json, useful for any handler listed under inputs [here](http://logstash.net/docs/1.1.5/).
Processors
----------
@@ -11,10 +11,9 @@
namespace Monolog\Formatter;
-use Monolog\Logger;
-
/**
* Serializes a log message to Logstash Event Format
+ *
* @see http://logstash.net/
* @see https://github.com/logstash/logstash/blob/master/lib/logstash/event.rb
*
@@ -66,14 +65,15 @@ public function format(array $record)
'@message' => $record['message'],
'@tags' => array($record['channel']),
'@source' => $this->systemName
- );
+ );
- if (isset($this->applicationName)) {
- $message['@type'] = $this->applicationName;
+ if ($this->applicationName) {
+ $message['@type'] = $this->applicationName;
}
$message['@fields'] = array();
$message['@fields']['channel'] = $record['channel'];
$message['@fields']['level'] = $record['level'];
+
if (isset($record['extra']['server'])) {
$message['@source_host'] = $record['extra']['server'];
}
@@ -67,6 +67,7 @@ public function handle(array $record)
$this->buffer[] = $record;
$this->bufferSize++;
+
return false === $this->bubble;
}
@@ -14,7 +14,6 @@
use Monolog\Logger;
use Monolog\Formatter\LineFormatter;
-
/**
* Logs to syslog service.
*
@@ -89,7 +89,6 @@ public function testFormatWithContext()
$message = json_decode($formatter->format($record), true);
-
$message_array = $message['@fields'];
$this->assertArrayHasKey('ctxt_from', $message_array);
@@ -99,7 +98,6 @@ public function testFormatWithContext()
$formatter = new LogstashFormatter('test', null, null, 'CTX');
$message = json_decode($formatter->format($record), true);
-
$message_array = $message['@fields'];
$this->assertArrayHasKey('CTXfrom', $message_array);
@@ -69,7 +69,7 @@ public function testProcessRecord()
$handledRecord = null;
$handler->expects($this->once())
->method('write')
- ->will($this->returnCallback(function($record) use (&$handledRecord){
+ ->will($this->returnCallback(function($record) use (&$handledRecord) {
$handledRecord = $record;
}))
;
@@ -23,4 +23,3 @@ public function publish(Message $message)
public $lastMessage = null;
}
-
@@ -196,7 +196,7 @@ public function testProcessorsNotCalledWhenNotHandled()
;
$logger->pushHandler($handler);
$that = $this;
- $logger->pushProcessor(function($record) use ($that){
+ $logger->pushProcessor(function($record) use ($that) {
$that->fail('The processor should not be called');
});
$logger->addAlert('test');

0 comments on commit 9c8db38

Please sign in to comment.