Ver Fonte

Merge branch '1.x'

Jordi Boggiano há 6 anos atrás
pai
commit
40cce3ba0b

+ 6 - 0
.php_cs

@@ -13,6 +13,12 @@ $finder = PhpCsFixer\Finder::create()
     ->files()
     ->name('*.php')
     ->exclude('Fixtures')
+    // The next 4 files are here for forward compatibility, and are not used by
+    // Monolog itself
+    ->exclude(__DIR__.'src/Monolog/Handler/FormattableHandlerInterface.php')
+    ->exclude(__DIR__.'src/Monolog/Handler/FormattableHandlerTrait.php')
+    ->exclude(__DIR__.'src/Monolog/Handler/ProcessableHandlerInterface.php')
+    ->exclude(__DIR__.'src/Monolog/Handler/ProcessableHandlerTrait.php')
     ->in(__DIR__.'/src')
     ->in(__DIR__.'/tests')
 ;

+ 1 - 1
composer.json

@@ -61,7 +61,7 @@
     },
     "scripts": {
         "test": [
-            "parallel-lint . --exclude vendor",
+            "parallel-lint . --exclude vendor --exclude src/Monolog/Handler/FormattableHandlerInterface.php  --exclude src/Monolog/Handler/FormattableHandlerTrait.php --exclude src/Monolog/Handler/ProcessableHandlerInterface.php --exclude src/Monolog/Handler/ProcessableHandlerTrait.php",
             "phpunit"
         ]
     },

+ 2 - 2
src/Monolog/Handler/ChromePHPHandler.php

@@ -46,7 +46,7 @@ class ChromePHPHandler extends AbstractProcessingHandler
     /**
      * Tracks whether we sent too much data
      *
-     * Chrome limits the headers to 256KB, so when we sent 240KB we stop sending
+     * Chrome limits the headers to 4KB, so when we sent 3KB we stop sending
      *
      * @var bool
      */
@@ -146,7 +146,7 @@ class ChromePHPHandler extends AbstractProcessingHandler
 
         $json = @json_encode(self::$json);
         $data = base64_encode(utf8_encode($json));
-        if (strlen($data) > 240 * 1024) {
+        if (strlen($data) > 3 * 1024) {
             self::$overflowed = true;
 
             $record = [

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

@@ -38,7 +38,7 @@ class InsightOpsHandler extends SocketHandler
     public function __construct(string $token, string $region = 'us', bool $useSSL = true, $level = Logger::DEBUG, bool $bubble = true)
     {
         if ($useSSL && !extension_loaded('openssl')) {
-            throw new MissingExtensionException('The OpenSSL PHP plugin is required to use SSL encrypted connection for LogEntriesHandler');
+            throw new MissingExtensionException('The OpenSSL PHP plugin is required to use SSL encrypted connection for InsightOpsHandler');
         }
 
         $endpoint = $useSSL

+ 3 - 3
tests/Monolog/Handler/ChromePHPHandlerTest.php

@@ -66,10 +66,10 @@ class ChromePHPHandlerTest extends TestCase
     {
         $handler = new TestChromePHPHandler();
         $handler->handle($this->getRecord(Logger::DEBUG));
-        $handler->handle($this->getRecord(Logger::WARNING, str_repeat('a', 150 * 1024)));
+        $handler->handle($this->getRecord(Logger::WARNING, str_repeat('a', 2 * 1024)));
 
         // overflow chrome headers limit
-        $handler->handle($this->getRecord(Logger::WARNING, str_repeat('a', 100 * 1024)));
+        $handler->handle($this->getRecord(Logger::WARNING, str_repeat('b', 2 * 1024)));
 
         $expected = [
             'X-ChromeLogger-Data'   => base64_encode(utf8_encode(json_encode([
@@ -84,7 +84,7 @@ class ChromePHPHandlerTest extends TestCase
                     ],
                     [
                         'test',
-                        str_repeat('a', 150 * 1024),
+                        str_repeat('a', 2 * 1024),
                         'unknown',
                         'warn',
                     ],