diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 74cbe2c1..7ac81281 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -163,11 +163,13 @@ private function normalizeConfig(array $config): array return $config; } - $config['monolog']['type'] ??= 'monolog'; - $config['monolog']['name'] ??= 'Monolog'; - $config['monolog']['finder']['in'] ??= '%kernel.logs_dir%'; - $config['monolog']['finder']['name'] ??= '*.log'; - $config['monolog']['finder']['depth'] ??= '== 0'; + $config['monolog']['type'] ??= 'monolog'; + $config['monolog']['name'] ??= 'Monolog'; + $config['monolog']['finder']['in'] ??= '%kernel.logs_dir%'; + $config['monolog']['finder']['name'] ??= '*.log'; + $config['monolog']['finder']['depth'] ??= '== 0'; + $config['monolog']['start_of_line_pattern'] ??= MonologLineParser::START_OF_MESSAGE_PATTERN; + $config['monolog']['log_message_pattern'] ??= MonologLineParser::LOG_LINE_PATTERN; return $config; } diff --git a/tests/Integration/DependencyInjection/data/expected-merge-monolog-config.json b/tests/Integration/DependencyInjection/data/expected-merge-monolog-config.json index 9182266f..a83304fd 100644 --- a/tests/Integration/DependencyInjection/data/expected-merge-monolog-config.json +++ b/tests/Integration/DependencyInjection/data/expected-merge-monolog-config.json @@ -12,8 +12,8 @@ "ignoreUnreadableDirs": true, "followLinks": false }, - "start_of_line_pattern": null, - "log_message_pattern": null, + "start_of_line_pattern": "/^\\[\\d{4}-\\d{2}-\\d{2}[^]]*]\\s+\\S+\\.\\S+:/", + "log_message_pattern": "/^\\[(?P[^\\]]+)\\]\\s+(?P[^\\.]+)\\.(?P[^:]+):\\s+(?P.*)\\s+(?P(?:{.*?}|\\[.*?]))\\s+(?P(?:{.*?}|\\[.*?]))\\s+$/s", "date_format": null } }, diff --git a/tests/Unit/Controller/DeleteFileControllerTest.php b/tests/Unit/Controller/DeleteFileControllerTest.php index 36eb19d1..90590dca 100644 --- a/tests/Unit/Controller/DeleteFileControllerTest.php +++ b/tests/Unit/Controller/DeleteFileControllerTest.php @@ -12,7 +12,6 @@ use PHPUnit\Framework\MockObject\MockObject; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Filesystem\Filesystem; -use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; @@ -69,9 +68,8 @@ public function testInvokeSuccess(): void $this->filesystem->expects(self::once())->method('remove')->with('path'); $this->fileService->expects(self::once())->method('findFileByIdentifier')->with('identifier')->willReturn($logFile); - $expected = new JsonResponse(['success' => true]); $response = ($this->controller)('identifier'); - static::assertEquals($expected, $response); + static::assertEquals('{"success":true}', $response->getContent()); } public function getController(): AbstractController