mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-24 13:52:53 +02:00
Merge pull request #1290 from versh23/fix-gelp-formtatter
use mb_ functions everywhere if possible
This commit is contained in:
@@ -253,6 +253,26 @@ class GelfMessageFormatterTest extends TestCase
|
||||
$this->assertGreaterThanOrEqual(131289, $length, 'The message should not be truncated');
|
||||
}
|
||||
|
||||
public function testFormatWithLargeCyrillicData()
|
||||
{
|
||||
$formatter = new GelfMessageFormatter();
|
||||
$record = [
|
||||
'level' => Logger::ERROR,
|
||||
'level_name' => 'ERROR',
|
||||
'channel' => 'meh',
|
||||
'context' => ['exception' => str_repeat('а', 32767)],
|
||||
'datetime' => new \DateTimeImmutable("@0"),
|
||||
'extra' => ['key' => str_repeat('б', 32767)],
|
||||
'message' => str_repeat('в', 32767),
|
||||
];
|
||||
$message = $formatter->format($record);
|
||||
$messageArray = $message->toArray();
|
||||
|
||||
$messageString = json_encode($messageArray);
|
||||
|
||||
$this->assertIsString($messageString);
|
||||
}
|
||||
|
||||
private function isLegacy()
|
||||
{
|
||||
return interface_exists('\Gelf\IMessagePublisher');
|
||||
|
@@ -14,7 +14,6 @@ namespace Monolog\Handler;
|
||||
use Monolog\Test\TestCase;
|
||||
use Monolog\Logger;
|
||||
use PhpAmqpLib\Message\AMQPMessage;
|
||||
use PhpAmqpLib\Connection\AMQPConnection;
|
||||
|
||||
/**
|
||||
* @covers Monolog\Handler\RotatingFileHandler
|
||||
|
@@ -67,7 +67,6 @@ class SyslogUdpHandlerTest extends TestCase
|
||||
$handler->handle($this->getRecordWithMessage(null));
|
||||
}
|
||||
|
||||
|
||||
public function testRfc()
|
||||
{
|
||||
$time = 'Jan 07 12:34:56';
|
||||
|
@@ -1,4 +1,13 @@
|
||||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
* (c) Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Monolog\Handler;
|
||||
|
||||
|
Reference in New Issue
Block a user