Loading CHANGELOG.md +2 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,8 @@ using the [Keep a CHANGELOG](https://keepachangelog.com/) principles. ### Changed ### Fixed - Formattable strings are not supported (issue [\#3309387](https://www.drupal.org/project/jsonlog/issues/3309387)). ## [3.0.0] - 2021-08-22 Loading src/Logger/JsonLogData.php +1 −1 Original line number Diff line number Diff line Loading @@ -3,9 +3,9 @@ namespace Drupal\jsonlog\Logger; use Drupal\Component\Serialization\Json; use Drupal\Component\Render\FormattableMarkup; use Drupal\Component\Utility\Unicode; use Drupal\Core\Logger\RfcLogLevel; use Drupal\Component\Render\FormattableMarkup; use Drupal\Core\StringTranslation\TranslatableMarkup; class JsonLogData { Loading tests/src/Unit/JsonLogDataTest.php +7 −7 Original line number Diff line number Diff line Loading @@ -2,10 +2,10 @@ namespace Drupal\Tests\jsonlog\Unit; use Drupal\Tests\UnitTestCase; use Drupal\Component\Render\FormattableMarkup; use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\jsonlog\Logger\JsonLogData; use Drupal\Tests\UnitTestCase; use Drupal\Tests\jsonlog\MockTranslation; /** Loading Loading @@ -86,23 +86,23 @@ class JsonLogDataTest extends UnitTestCase { $this->assertEmpty($this->data->getTrunc(), 'Message not truncated'); } public function testCanSetFormattableMessage() { public function testCanSetTranslatableMessage() { $this->data = new JsonLogData('test_site_id', 'test_canonical'); $this->assertNull($this->data->getMessage(), 'Message empty by default'); $msg = new FormattableMarkup('formattable logging item', []); $msg = new TranslatableMarkup('translatable logging item', [], [], new MockTranslation()); $this->data->setMessage($msg); $this->assertEquals('formattable logging item', $this->data->getMessage(), 'By default message gets logged.'); $this->assertEquals('translatable logging item', $this->data->getMessage(), 'By default message gets logged.'); $this->assertEmpty($this->data->getTrunc(), 'Message not truncated'); } public function testCanSetTranslatableMessage() { public function testCanSetFormattableMessage() { $this->data = new JsonLogData('test_site_id', 'test_canonical'); $this->assertNull($this->data->getMessage(), 'Message empty by default'); $msg = new TranslatableMarkup('translatable logging item', [], [], new MockTranslation()); $msg = new FormattableMarkup('formattable logging item', []); $this->data->setMessage($msg); $this->assertEquals('translatable logging item', $this->data->getMessage(), 'By default message gets logged.'); $this->assertEquals('formattable logging item', $this->data->getMessage(), 'By default message gets logged.'); $this->assertEmpty($this->data->getTrunc(), 'Message not truncated'); } Loading Loading
CHANGELOG.md +2 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,8 @@ using the [Keep a CHANGELOG](https://keepachangelog.com/) principles. ### Changed ### Fixed - Formattable strings are not supported (issue [\#3309387](https://www.drupal.org/project/jsonlog/issues/3309387)). ## [3.0.0] - 2021-08-22 Loading
src/Logger/JsonLogData.php +1 −1 Original line number Diff line number Diff line Loading @@ -3,9 +3,9 @@ namespace Drupal\jsonlog\Logger; use Drupal\Component\Serialization\Json; use Drupal\Component\Render\FormattableMarkup; use Drupal\Component\Utility\Unicode; use Drupal\Core\Logger\RfcLogLevel; use Drupal\Component\Render\FormattableMarkup; use Drupal\Core\StringTranslation\TranslatableMarkup; class JsonLogData { Loading
tests/src/Unit/JsonLogDataTest.php +7 −7 Original line number Diff line number Diff line Loading @@ -2,10 +2,10 @@ namespace Drupal\Tests\jsonlog\Unit; use Drupal\Tests\UnitTestCase; use Drupal\Component\Render\FormattableMarkup; use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\jsonlog\Logger\JsonLogData; use Drupal\Tests\UnitTestCase; use Drupal\Tests\jsonlog\MockTranslation; /** Loading Loading @@ -86,23 +86,23 @@ class JsonLogDataTest extends UnitTestCase { $this->assertEmpty($this->data->getTrunc(), 'Message not truncated'); } public function testCanSetFormattableMessage() { public function testCanSetTranslatableMessage() { $this->data = new JsonLogData('test_site_id', 'test_canonical'); $this->assertNull($this->data->getMessage(), 'Message empty by default'); $msg = new FormattableMarkup('formattable logging item', []); $msg = new TranslatableMarkup('translatable logging item', [], [], new MockTranslation()); $this->data->setMessage($msg); $this->assertEquals('formattable logging item', $this->data->getMessage(), 'By default message gets logged.'); $this->assertEquals('translatable logging item', $this->data->getMessage(), 'By default message gets logged.'); $this->assertEmpty($this->data->getTrunc(), 'Message not truncated'); } public function testCanSetTranslatableMessage() { public function testCanSetFormattableMessage() { $this->data = new JsonLogData('test_site_id', 'test_canonical'); $this->assertNull($this->data->getMessage(), 'Message empty by default'); $msg = new TranslatableMarkup('translatable logging item', [], [], new MockTranslation()); $msg = new FormattableMarkup('formattable logging item', []); $this->data->setMessage($msg); $this->assertEquals('translatable logging item', $this->data->getMessage(), 'By default message gets logged.'); $this->assertEquals('formattable logging item', $this->data->getMessage(), 'By default message gets logged.'); $this->assertEmpty($this->data->getTrunc(), 'Message not truncated'); } Loading