Jordi Boggiano 12 лет назад
Родитель
Сommit
99aad2e059

+ 6 - 13
src/Monolog/Formatter/LogstashFormatter.php

@@ -21,7 +21,6 @@ namespace Monolog\Formatter;
  */
 class LogstashFormatter extends NormalizerFormatter
 {
-
     const V0 = 0;
     const V1 = 1;
 
@@ -46,7 +45,7 @@ class LogstashFormatter extends NormalizerFormatter
     protected $contextPrefix;
 
     /**
-     * @var integer LogStash format version to use
+     * @var integer logstash format version to use
      */
     protected $version;
 
@@ -58,15 +57,13 @@ class LogstashFormatter extends NormalizerFormatter
      */
     public function __construct($applicationName, $systemName = null, $extraPrefix = null, $contextPrefix = 'ctxt_', $version = self::V0)
     {
-        //log stash requires a ISO 8601 format date
+        // logstash requires a ISO 8601 format date
         parent::__construct('c');
 
         $this->systemName = $systemName ?: gethostname();
         $this->applicationName = $applicationName;
-
         $this->extraPrefix = $extraPrefix;
         $this->contextPrefix = $contextPrefix;
-
         $this->version = $version;
     }
 
@@ -77,14 +74,10 @@ class LogstashFormatter extends NormalizerFormatter
     {
         $record = parent::format($record);
 
-        switch ($this->version) {
-            case self::V1:
-                $message = $this->formatV1($record);
-                break;
-            case self::V0:
-            default:
-                $message = $this->formatV0($record);
-                break;
+        if ($this->version === self::V1) {
+            $message = $this->formatV1($record);
+        } else {
+            $message = $this->formatV0($record);
         }
 
         return $this->toJson($message) . "\n";

+ 1 - 1
src/Monolog/Handler/NewRelicHandler.php

@@ -78,7 +78,7 @@ class NewRelicHandler extends AbstractProcessingHandler
      * Returns the appname where this log should be sent. Each log can override the default appname, set in this
      * handler's constructor, by providing the appname in its context.
      *
-     * @param array $context
+     * @param  array       $context
      * @return null|string
      */
     protected function getAppName(array $context)

+ 0 - 1
tests/Monolog/Formatter/LogstashFormatterTest.php

@@ -158,7 +158,6 @@ class LogstashFormatterTest extends \PHPUnit_Framework_TestCase
         $this->assertEquals('app', $message['@type']);
     }
 
-
     /**
      * @covers Monolog\Formatter\LogstashFormatter::format
      */