1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-07-31 10:20:14 +02:00

use mb_ functions in GelfFormatter

This commit is contained in:
vershinin_so
2019-02-14 10:32:48 +03:00
parent bf486002a0
commit ada57dd4a1
2 changed files with 26 additions and 6 deletions

View File

@@ -251,6 +251,26 @@ class GelfMessageFormatterTest extends \PHPUnit\Framework\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');