snapshotpl 11 лет назад
Родитель
Сommit
4a6f9cabb0

+ 4 - 2
src/Monolog/Formatter/WildfireFormatter.php

@@ -22,6 +22,8 @@ use Monolog\Logger;
  */
 class WildfireFormatter extends NormalizerFormatter
 {
+    const TABLE = 'table';
+
     /**
      * Translates Monolog log levels to Wildfire levels.
      */
@@ -67,10 +69,10 @@ class WildfireFormatter extends NormalizerFormatter
             $message = reset($message);
         }
 
-        if(isset($record['context']['table'])){
+        if(isset($record['context'][self::TABLE])){
             $type  = 'TYPE';
             $label = $record['channel'] .': '. $record['message'];
-            $message = $record['context']['table'];
+            $message = $record['context'][self::TABLE];
         } else {
             $type  = $this->logLevels[$record['level']];
             $label = $record['channel'];

+ 1 - 1
tests/Monolog/Formatter/WildfireFormatterTest.php

@@ -120,7 +120,7 @@ class WildfireFormatterTest extends \PHPUnit_Framework_TestCase
             'level_name' => 'ERROR',
             'channel' => 'table-channel',
             'context' => array(
-                'table' => array(
+            WildfireFormatter::TABLE => array(
                     array('col1', 'col2', 'col3'),
                     array('val1', 'val2', 'val3'),
                     array('foo1', 'foo2', 'foo3'),