From 3efd44c742993f21aa00e86f459994e18adc9ab8 Mon Sep 17 00:00:00 2001 From: luanfreitasdev Date: Thu, 8 Feb 2024 11:53:07 -0300 Subject: [PATCH 01/21] Add Support Laravel 11 --- .github/workflows/run-tests.yml | 12 ++++++++++-- composer.json | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 2c46d722..8e9a6f0c 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -14,11 +14,15 @@ jobs: matrix: os: [ubuntu-latest, windows-latest] php: [8.1, 8.0] - laravel: [9.*, 10.*] + laravel: [9.*, 10.*, 11.*] stability: [prefer-lowest, prefer-stable] exclude: - php: 8.0 laravel: 10.* + - php: 8.0 + laravel: 11.* + - php: 8.1 + laravel: 11.* include: - laravel: 9.* testbench: 7.* @@ -28,12 +32,16 @@ jobs: testbench: 8.* pest: 2.* collision: 7.* + - laravel: 11.* + testbench: 9.* + pest: 2.* + collision: 8.* name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 diff --git a/composer.json b/composer.json index 58ee38f7..33acc0ce 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ ], "require": { "php": "^8.0", - "illuminate/contracts": "^8.0|^9.0|^10.0", + "illuminate/contracts": "^8.0|^9.0|^10.0|^11.0", "opcodesio/mail-parser": "^0.1.6" }, "require-dev": { @@ -28,7 +28,7 @@ "itsgoingd/clockwork": "^5.1", "laravel/pint": "^1.0", "nunomaduro/collision": "^7.0", - "orchestra/testbench": "^7.6|^8.0", + "orchestra/testbench": "^7.6|^8.0|^9.0", "pestphp/pest": "^2.0", "pestphp/pest-plugin-laravel": "^2.0", "spatie/test-time": "^1.3" From 40536171e0dbf87eaf367b88ab79aadb059b6b39 Mon Sep 17 00:00:00 2001 From: luanfreitasdev Date: Thu, 8 Feb 2024 12:54:10 -0300 Subject: [PATCH 02/21] Fix gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index de939c45..cf5556ab 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .idea .DS_Store .phpunit.result.cache +.phpunit.cache build composer.lock coverage From fef3e92eae23a5c4fc9297d2883ef8a295d44fa3 Mon Sep 17 00:00:00 2001 From: luanfreitasdev Date: Thu, 8 Feb 2024 12:56:33 -0300 Subject: [PATCH 03/21] WIP --- .github/workflows/run-tests.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 8e9a6f0c..3c32bd20 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -2,9 +2,8 @@ name: run-tests on: push: - branches: [main, 1.x, 2.x] - pull_request: - branches: [main, 1.x, 2.x] + branches: + - "**" jobs: test: From 1292aaac198f475762ca658c5bcd71e8c0170b65 Mon Sep 17 00:00:00 2001 From: luanfreitasdev Date: Thu, 8 Feb 2024 12:57:26 -0300 Subject: [PATCH 04/21] WIP --- .github/workflows/run-tests.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 3c32bd20..9327cb5c 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -2,8 +2,7 @@ name: run-tests on: push: - branches: - - "**" + branches: [feat/laravel11] jobs: test: From 3aeda0f119004451866f5bb3de36e3e12f5526b9 Mon Sep 17 00:00:00 2001 From: Luan Freitas <33601626+luanfreitasdev@users.noreply.github.com> Date: Thu, 8 Feb 2024 13:03:27 -0300 Subject: [PATCH 05/21] Update run-tests.yml --- .github/workflows/run-tests.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 9327cb5c..2fe78aca 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -1,16 +1,17 @@ -name: run-tests +name: Tests on: push: - branches: [feat/laravel11] + branches: + - "**" + pull_request: + types: [ready_for_review, synchronize, opened] jobs: - test: - runs-on: ${{ matrix.os }} + build: + runs-on: ubuntu-latest strategy: - fail-fast: true matrix: - os: [ubuntu-latest, windows-latest] php: [8.1, 8.0] laravel: [9.*, 10.*, 11.*] stability: [prefer-lowest, prefer-stable] @@ -35,8 +36,8 @@ jobs: pest: 2.* collision: 8.* - name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} - + name: PHP:${{ matrix.php }} / L:${{ matrix.laravel }} + steps: - name: Checkout code uses: actions/checkout@v4 From 1cebab3f2f504b2b30a0967cd3800d68b616a64b Mon Sep 17 00:00:00 2001 From: Luan Freitas <33601626+luanfreitasdev@users.noreply.github.com> Date: Thu, 8 Feb 2024 13:05:17 -0300 Subject: [PATCH 06/21] Update run-tests.yml --- .github/workflows/run-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 2fe78aca..1486b87f 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -11,6 +11,7 @@ jobs: build: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: php: [8.1, 8.0] laravel: [9.*, 10.*, 11.*] From b4ce09e0dd323d0d6f35d70fe10c4e8ef105a29d Mon Sep 17 00:00:00 2001 From: luanfreitasdev Date: Thu, 8 Feb 2024 13:09:58 -0300 Subject: [PATCH 07/21] WIP --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 33acc0ce..0764a0c4 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "guzzlehttp/guzzle": "^7.2", "itsgoingd/clockwork": "^5.1", "laravel/pint": "^1.0", - "nunomaduro/collision": "^7.0", + "nunomaduro/collision": "^7.0|^8.0", "orchestra/testbench": "^7.6|^8.0|^9.0", "pestphp/pest": "^2.0", "pestphp/pest-plugin-laravel": "^2.0", From 4f4dd8e3ae48951291542147325d95747cf82fdc Mon Sep 17 00:00:00 2001 From: luanfreitasdev Date: Thu, 8 Feb 2024 13:12:29 -0300 Subject: [PATCH 08/21] WIP --- .github/workflows/run-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 1486b87f..8e06c68c 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - php: [8.1, 8.0] + php: [8.2, 8.1, 8.0] laravel: [9.*, 10.*, 11.*] stability: [prefer-lowest, prefer-stable] exclude: @@ -38,7 +38,7 @@ jobs: collision: 8.* name: PHP:${{ matrix.php }} / L:${{ matrix.laravel }} - + steps: - name: Checkout code uses: actions/checkout@v4 From f33b405c0e534783b05cd52218e1cc2ba8ef821c Mon Sep 17 00:00:00 2001 From: luanfreitasdev Date: Thu, 8 Feb 2024 13:15:46 -0300 Subject: [PATCH 09/21] WIP --- .github/workflows/run-tests.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 8e06c68c..23142701 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - php: [8.2, 8.1, 8.0] + php: ['8.2', '8.1', '8.0'] laravel: [9.*, 10.*, 11.*] stability: [prefer-lowest, prefer-stable] exclude: @@ -23,6 +23,8 @@ jobs: laravel: 11.* - php: 8.1 laravel: 11.* + - php: 8.2 + laravel: 9.* include: - laravel: 9.* testbench: 7.* From df40f0b2127b71df02e911a322130535894c0495 Mon Sep 17 00:00:00 2001 From: luanfreitasdev Date: Thu, 8 Feb 2024 13:19:54 -0300 Subject: [PATCH 10/21] Rollback github actions --- .github/workflows/run-tests.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 23142701..029fe1dd 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -1,11 +1,10 @@ -name: Tests +name: run-tests on: push: - branches: - - "**" + branches: [main, 1.x, 2.x] pull_request: - types: [ready_for_review, synchronize, opened] + branches: [main, 1.x, 2.x] jobs: build: From 115bb7757f79c7cb0aa7bc8691b03bef884ccb3f Mon Sep 17 00:00:00 2001 From: luanfreitasdev Date: Sat, 10 Feb 2024 13:20:24 -0300 Subject: [PATCH 11/21] wip --- src/Logs/HorizonLog.php | 4 +--- src/Logs/HorizonOldLog.php | 4 +--- src/Logs/HttpAccessLog.php | 8 ++++---- src/Logs/HttpApacheErrorLog.php | 8 ++++---- src/Logs/HttpNginxErrorLog.php | 8 ++++---- src/Logs/LaravelLog.php | 4 +--- src/Logs/Log.php | 12 ++++++++---- src/Logs/PostgresLog.php | 4 +++- src/Logs/SupervisorLog.php | 4 +++- tests/Unit/LogTest.php | 2 +- 10 files changed, 30 insertions(+), 28 deletions(-) diff --git a/src/Logs/HorizonLog.php b/src/Logs/HorizonLog.php index 24e9d869..ca405756 100644 --- a/src/Logs/HorizonLog.php +++ b/src/Logs/HorizonLog.php @@ -19,9 +19,7 @@ class HorizonLog extends Log protected function fillMatches(array $matches = []): void { - $this->datetime = $this->parseDatetime($matches['datetime'])?->tz( - config('log-viewer.timezone', config('app.timezone', 'UTC')) - ); + $this->datetime = $this->parseDatetime($matches['datetime']); $this->level = $matches['level']; $this->message = $matches['message']; $this->context = array_filter([ diff --git a/src/Logs/HorizonOldLog.php b/src/Logs/HorizonOldLog.php index 3c4c071a..4ec67301 100644 --- a/src/Logs/HorizonOldLog.php +++ b/src/Logs/HorizonOldLog.php @@ -18,9 +18,7 @@ class HorizonOldLog extends Log protected function fillMatches(array $matches = []): void { - $this->datetime = $this->parseDatetime($matches['datetime'])?->tz( - config('log-viewer.timezone', config('app.timezone', 'UTC')) - ); + $this->datetime = $this->parseDatetime($matches['datetime']); $this->level = $matches['level']; $this->message = $matches['message']; $this->context = [ diff --git a/src/Logs/HttpAccessLog.php b/src/Logs/HttpAccessLog.php index f2bbf0e4..a3a060be 100644 --- a/src/Logs/HttpAccessLog.php +++ b/src/Logs/HttpAccessLog.php @@ -34,9 +34,7 @@ protected function fillMatches(array $matches = []): void 'user_agent' => $matches['user_agent'] ?? null, ]; - $this->datetime = static::parseDateTime($matches['datetime'] ?? null)?->tz( - config('log-viewer.timezone', config('app.timezone', 'UTC')) - ); + $this->datetime = static::parseDateTime($matches['datetime'] ?? null); $this->level = $matches['status_code'] ?? null; $this->message = sprintf( '%s %s', @@ -47,6 +45,8 @@ protected function fillMatches(array $matches = []): void public static function parseDatetime(?string $datetime): ?CarbonInterface { - return $datetime ? Carbon::createFromFormat('d/M/Y:H:i:s O', $datetime) : null; + $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')); + + return $datetime ? Carbon::createFromFormat('d/M/Y:H:i:s O', $datetime, $timezone) : null; } } diff --git a/src/Logs/HttpApacheErrorLog.php b/src/Logs/HttpApacheErrorLog.php index 91495057..8d27a157 100644 --- a/src/Logs/HttpApacheErrorLog.php +++ b/src/Logs/HttpApacheErrorLog.php @@ -14,9 +14,7 @@ class HttpApacheErrorLog extends Log protected function fillMatches(array $matches = []): void { - $this->datetime = static::parseDateTime($matches['datetime'] ?? null)?->tz( - config('log-viewer.timezone', config('app.timezone', 'UTC')) - ); + $this->datetime = static::parseDateTime($matches['datetime'] ?? null); $this->level = $matches['level'] ?? null; $this->message = $matches['message'] ?? null; @@ -29,6 +27,8 @@ protected function fillMatches(array $matches = []): void public static function parseDateTime(?string $datetime): ?CarbonInterface { - return $datetime ? Carbon::createFromFormat('D M d H:i:s.u Y', $datetime) : null; + $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')); + + return $datetime ? Carbon::createFromFormat('D M d H:i:s.u Y', $datetime, $timezone) : null; } } diff --git a/src/Logs/HttpNginxErrorLog.php b/src/Logs/HttpNginxErrorLog.php index a2d8f227..bc0e8f48 100644 --- a/src/Logs/HttpNginxErrorLog.php +++ b/src/Logs/HttpNginxErrorLog.php @@ -14,9 +14,7 @@ class HttpNginxErrorLog extends Log protected function fillMatches(array $matches = []): void { - $this->datetime = static::parseDateTime($matches['datetime'] ?? null)?->tz( - config('log-viewer.timezone', config('app.timezone', 'UTC')) - ); + $this->datetime = static::parseDateTime($matches['datetime'] ?? null); $this->level = $matches['level'] ?? null; $this->message = $matches['errormessage'] ?? null; @@ -30,6 +28,8 @@ protected function fillMatches(array $matches = []): void public static function parseDateTime(?string $datetime): ?CarbonInterface { - return $datetime ? Carbon::createFromFormat('Y/m/d H:i:s', $datetime) : null; + $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')); + + return $datetime ? Carbon::createFromFormat('Y/m/d H:i:s', $datetime, $timezone) : null; } } diff --git a/src/Logs/LaravelLog.php b/src/Logs/LaravelLog.php index f2ba646b..21fff00c 100644 --- a/src/Logs/LaravelLog.php +++ b/src/Logs/LaravelLog.php @@ -38,9 +38,7 @@ protected function parseText(array &$matches = []): void preg_match(static::regexPattern(), array_shift($firstLineSplit), $matches); - $this->datetime = Carbon::parse($matches[1])->tz( - config('log-viewer.timezone', config('app.timezone', 'UTC')) - ); + $this->datetime = Carbon::parse($matches[1], config('log-viewer.timezone', config('app.timezone', 'UTC'))); // $matches[2] contains microseconds, which is already handled // $matches[3] contains timezone offset, which is already handled diff --git a/src/Logs/Log.php b/src/Logs/Log.php index 3be76b7b..bcdfd957 100644 --- a/src/Logs/Log.php +++ b/src/Logs/Log.php @@ -80,7 +80,13 @@ public static function matches(string $text, ?int &$timestamp = null, ?string &$ public static function parseDatetime(?string $datetime): ?CarbonInterface { - return $datetime ? Carbon::parse($datetime) : null; + $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')); + + if (is_string($datetime)) { + return Carbon::parse($datetime, $timezone); + } + + return $datetime ? Carbon::parse($datetime, $timezone) : null; } /** @@ -104,9 +110,7 @@ protected function parseText(array &$matches = []): void protected function fillMatches(array $matches = []): void { - $this->datetime = static::parseDatetime($matches[static::$regexDatetimeKey] ?? null)?->tz( - config('log-viewer.timezone', config('app.timezone')) - ); + $this->datetime = static::parseDatetime($matches[static::$regexDatetimeKey] ?? null); $this->level = $matches[static::$regexLevelKey] ?? null; $this->message = trim($matches[static::$regexMessageKey] ?? null); $this->context = []; diff --git a/src/Logs/PostgresLog.php b/src/Logs/PostgresLog.php index dfb75792..e24d73c2 100644 --- a/src/Logs/PostgresLog.php +++ b/src/Logs/PostgresLog.php @@ -21,6 +21,8 @@ protected function fillMatches(array $matches = []): void public static function parseDatetime(?string $datetime): ?CarbonInterface { - return isset($datetime) ? Carbon::createFromFormat('Y-m-d H:i:s.u T', $datetime) : null; + $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')); + + return isset($datetime) ? Carbon::createFromFormat('Y-m-d H:i:s.u T', $datetime, $timezone) : null; } } diff --git a/src/Logs/SupervisorLog.php b/src/Logs/SupervisorLog.php index 5780abed..b83c597e 100644 --- a/src/Logs/SupervisorLog.php +++ b/src/Logs/SupervisorLog.php @@ -14,6 +14,8 @@ class SupervisorLog extends Log public static function parseDatetime(?string $datetime): ?CarbonInterface { - return $datetime ? Carbon::createFromFormat('Y-m-d H:i:s,u', $datetime) : null; + $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')); + + return $datetime ? Carbon::createFromFormat('Y-m-d H:i:s,u', $datetime, $timezone) : null; } } diff --git a/tests/Unit/LogTest.php b/tests/Unit/LogTest.php index a9be5ba9..ef2270d2 100644 --- a/tests/Unit/LogTest.php +++ b/tests/Unit/LogTest.php @@ -167,7 +167,7 @@ $log = new LaravelLog($text, 'laravel.log', 0, 0); assertEquals($tz, $log->datetime->timezoneName); - $expectedTime = \Carbon\Carbon::parse('2022-11-07 17:51:33', 'UTC')->tz($tz)->toDateTimeString(); + $expectedTime = \Carbon\Carbon::parse('2022-11-07 17:51:33', $tz)->toDateTimeString(); assertEquals($expectedTime, $log->datetime->toDateTimeString()); }); From 9ec247f5f269e8ba2aeead1d60ad5d2fd5004ea1 Mon Sep 17 00:00:00 2001 From: luanfreitasdev Date: Sat, 10 Feb 2024 13:21:38 -0300 Subject: [PATCH 12/21] wip --- .github/workflows/run-tests.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 029fe1dd..73758523 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -1,10 +1,7 @@ name: run-tests on: - push: - branches: [main, 1.x, 2.x] - pull_request: - branches: [main, 1.x, 2.x] + workflow_dispatch: jobs: build: From 92bc2c23630a5f062133e2242709b11ec04417de Mon Sep 17 00:00:00 2001 From: luanfreitasdev Date: Sat, 10 Feb 2024 13:29:08 -0300 Subject: [PATCH 13/21] fix postgress test --- src/Logs/Log.php | 8 +------- tests/Unit/PostgresLogs/PostgresLogTest.php | 6 +++--- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/Logs/Log.php b/src/Logs/Log.php index bcdfd957..0b6f2e16 100644 --- a/src/Logs/Log.php +++ b/src/Logs/Log.php @@ -80,13 +80,7 @@ public static function matches(string $text, ?int &$timestamp = null, ?string &$ public static function parseDatetime(?string $datetime): ?CarbonInterface { - $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')); - - if (is_string($datetime)) { - return Carbon::parse($datetime, $timezone); - } - - return $datetime ? Carbon::parse($datetime, $timezone) : null; + return $datetime ? Carbon::parse($datetime) : null; } /** diff --git a/tests/Unit/PostgresLogs/PostgresLogTest.php b/tests/Unit/PostgresLogs/PostgresLogTest.php index bb4e1a85..4b20c233 100644 --- a/tests/Unit/PostgresLogs/PostgresLogTest.php +++ b/tests/Unit/PostgresLogs/PostgresLogTest.php @@ -31,15 +31,15 @@ $logReader = $file->logs()->scan(); expect($logs = $logReader->get())->toHaveCount(9) - ->and($logs[0]->datetime->toDateTimeString())->toBe('2022-11-26 13:30:59') + ->and($logs[0]->datetime->toDateTimeString())->toBe('2022-11-26 15:30:59') ->and($logs[0]->level)->toBe('CONTEXT') ->and($logs[0]->message)->toBe('PL/pgSQL function inline_code_block line 16 at RAISE') ->and($logs[0]->context['pid'])->toBe(20532) - ->and($logs[1]->datetime->toDateTimeString())->toBe('2022-11-26 13:32:04') + ->and($logs[1]->datetime->toDateTimeString())->toBe('2022-11-26 15:32:04') ->and($logs[1]->level)->toBe('WARNING') ->and($logs[1]->message)->toBe('WELCOME TO') ->and($logs[1]->context['pid'])->toBe(18913) - ->and($logs[2]->datetime->toDateTimeString())->toBe('2022-11-26 13:32:04') + ->and($logs[2]->datetime->toDateTimeString())->toBe('2022-11-26 15:32:04') ->and($logs[2]->level)->toBe('CONTEXT') ->and($logs[2]->message)->toBe('PL/pgSQL function inline_code_block line 16 at RAISE') ->and($logs[2]->context['pid'])->toBe(18913); From 9b29632be661a68f0d4a5ed859de6e0d688bc974 Mon Sep 17 00:00:00 2001 From: luanfreitasdev Date: Sat, 10 Feb 2024 13:31:12 -0300 Subject: [PATCH 14/21] Rollback github actions --- .github/workflows/run-tests.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 73758523..029fe1dd 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -1,7 +1,10 @@ name: run-tests on: - workflow_dispatch: + push: + branches: [main, 1.x, 2.x] + pull_request: + branches: [main, 1.x, 2.x] jobs: build: From 89fc7f7c90f9c418f57270155e95051f56e9ecdd Mon Sep 17 00:00:00 2001 From: luanfreitasdev Date: Tue, 13 Feb 2024 20:49:42 +0000 Subject: [PATCH 15/21] Fix styling --- src/LogLevels/LaravelLogLevel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LogLevels/LaravelLogLevel.php b/src/LogLevels/LaravelLogLevel.php index d98f586f..25638d8a 100644 --- a/src/LogLevels/LaravelLogLevel.php +++ b/src/LogLevels/LaravelLogLevel.php @@ -53,7 +53,7 @@ public function getClass(): LevelClass { return match ($this->value) { self::Debug, self::Info => LevelClass::info(), - self::Notice =>LevelClass::notice(), + self::Notice => LevelClass::notice(), self::Warning => LevelClass::warning(), self::Error, self::Critical, self::Alert, self::Emergency => LevelClass::danger(), default => LevelClass::none(), From 6dbcd18197a65a8cdd78ecebf9b1b588c1a749fd Mon Sep 17 00:00:00 2001 From: luanfreitasdev Date: Tue, 13 Feb 2024 17:53:25 -0300 Subject: [PATCH 16/21] revert github actions --- .github/workflows/run-tests.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 029fe1dd..a3d0c180 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -7,13 +7,14 @@ on: branches: [main, 1.x, 2.x] jobs: - build: - runs-on: ubuntu-latest + test: + runs-on: ${{ matrix.os }} strategy: - fail-fast: false + fail-fast: true matrix: + os: [ubuntu-latest, windows-latest] php: ['8.2', '8.1', '8.0'] - laravel: [9.*, 10.*, 11.*] + laravel: [9.*, 10.*] stability: [prefer-lowest, prefer-stable] exclude: - php: 8.0 @@ -38,7 +39,7 @@ jobs: pest: 2.* collision: 8.* - name: PHP:${{ matrix.php }} / L:${{ matrix.laravel }} + name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} steps: - name: Checkout code From 73af0937d40069eb5966ce85327d682e317bf0f3 Mon Sep 17 00:00:00 2001 From: luanfreitasdev Date: Tue, 13 Feb 2024 18:10:49 -0300 Subject: [PATCH 17/21] Remove timezone from Carbon::createFromFormat --- src/Logs/HorizonLog.php | 4 +++- src/Logs/HorizonOldLog.php | 5 ++++- src/Logs/HttpAccessLog.php | 9 +++++---- src/Logs/HttpApacheErrorLog.php | 9 +++++---- src/Logs/HttpNginxErrorLog.php | 9 +++++---- src/Logs/Log.php | 5 ++++- src/Logs/PostgresLog.php | 4 +--- src/Logs/SupervisorLog.php | 4 +--- 8 files changed, 28 insertions(+), 21 deletions(-) diff --git a/src/Logs/HorizonLog.php b/src/Logs/HorizonLog.php index ca405756..b91afa0e 100644 --- a/src/Logs/HorizonLog.php +++ b/src/Logs/HorizonLog.php @@ -19,7 +19,9 @@ class HorizonLog extends Log protected function fillMatches(array $matches = []): void { - $this->datetime = $this->parseDatetime($matches['datetime']); + $datetime = $this->parseDateTime($matches['datetime'] ?? null); + $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')); + $this->datetime = $timezone ? $datetime->setTimezone($timezone) : $datetime; $this->level = $matches['level']; $this->message = $matches['message']; $this->context = array_filter([ diff --git a/src/Logs/HorizonOldLog.php b/src/Logs/HorizonOldLog.php index 4ec67301..348f860d 100644 --- a/src/Logs/HorizonOldLog.php +++ b/src/Logs/HorizonOldLog.php @@ -18,7 +18,10 @@ class HorizonOldLog extends Log protected function fillMatches(array $matches = []): void { - $this->datetime = $this->parseDatetime($matches['datetime']); + $datetime = static::parseDateTime($matches['datetime'] ?? null); + $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')); + $this->datetime = $timezone ? $datetime->setTimezone($timezone) : $datetime; + $this->level = $matches['level']; $this->message = $matches['message']; $this->context = [ diff --git a/src/Logs/HttpAccessLog.php b/src/Logs/HttpAccessLog.php index a3a060be..1901a1a0 100644 --- a/src/Logs/HttpAccessLog.php +++ b/src/Logs/HttpAccessLog.php @@ -34,7 +34,10 @@ protected function fillMatches(array $matches = []): void 'user_agent' => $matches['user_agent'] ?? null, ]; - $this->datetime = static::parseDateTime($matches['datetime'] ?? null); + $datetime = static::parseDateTime($matches['datetime'] ?? null); + $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')); + $this->datetime = $timezone ? $datetime->setTimezone($timezone) : $datetime; + $this->level = $matches['status_code'] ?? null; $this->message = sprintf( '%s %s', @@ -45,8 +48,6 @@ protected function fillMatches(array $matches = []): void public static function parseDatetime(?string $datetime): ?CarbonInterface { - $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')); - - return $datetime ? Carbon::createFromFormat('d/M/Y:H:i:s O', $datetime, $timezone) : null; + return $datetime ? Carbon::createFromFormat('d/M/Y:H:i:s O', $datetime) : null; } } diff --git a/src/Logs/HttpApacheErrorLog.php b/src/Logs/HttpApacheErrorLog.php index 8d27a157..9d40386c 100644 --- a/src/Logs/HttpApacheErrorLog.php +++ b/src/Logs/HttpApacheErrorLog.php @@ -14,7 +14,10 @@ class HttpApacheErrorLog extends Log protected function fillMatches(array $matches = []): void { - $this->datetime = static::parseDateTime($matches['datetime'] ?? null); + $datetime = static::parseDateTime($matches['datetime'] ?? null); + $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')); + $this->datetime = $timezone ? $datetime->setTimezone($timezone) : $datetime; + $this->level = $matches['level'] ?? null; $this->message = $matches['message'] ?? null; @@ -27,8 +30,6 @@ protected function fillMatches(array $matches = []): void public static function parseDateTime(?string $datetime): ?CarbonInterface { - $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')); - - return $datetime ? Carbon::createFromFormat('D M d H:i:s.u Y', $datetime, $timezone) : null; + return $datetime ? Carbon::createFromFormat('D M d H:i:s.u Y', $datetime) : null; } } diff --git a/src/Logs/HttpNginxErrorLog.php b/src/Logs/HttpNginxErrorLog.php index bc0e8f48..2dff8d79 100644 --- a/src/Logs/HttpNginxErrorLog.php +++ b/src/Logs/HttpNginxErrorLog.php @@ -14,7 +14,10 @@ class HttpNginxErrorLog extends Log protected function fillMatches(array $matches = []): void { - $this->datetime = static::parseDateTime($matches['datetime'] ?? null); + $datetime = static::parseDateTime($matches['datetime'] ?? null); + $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')); + $this->datetime = $timezone ? $datetime->setTimezone($timezone) : $datetime; + $this->level = $matches['level'] ?? null; $this->message = $matches['errormessage'] ?? null; @@ -28,8 +31,6 @@ protected function fillMatches(array $matches = []): void public static function parseDateTime(?string $datetime): ?CarbonInterface { - $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')); - - return $datetime ? Carbon::createFromFormat('Y/m/d H:i:s', $datetime, $timezone) : null; + return $datetime ? Carbon::createFromFormat('Y/m/d H:i:s', $datetime) : null; } } diff --git a/src/Logs/Log.php b/src/Logs/Log.php index 0b6f2e16..657e7932 100644 --- a/src/Logs/Log.php +++ b/src/Logs/Log.php @@ -104,7 +104,10 @@ protected function parseText(array &$matches = []): void protected function fillMatches(array $matches = []): void { - $this->datetime = static::parseDatetime($matches[static::$regexDatetimeKey] ?? null); + $datetime = static::parseDateTime($matches['datetime'] ?? null); + $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')); + $this->datetime = $timezone ? $datetime->setTimezone($timezone) : $datetime; + $this->level = $matches[static::$regexLevelKey] ?? null; $this->message = trim($matches[static::$regexMessageKey] ?? null); $this->context = []; diff --git a/src/Logs/PostgresLog.php b/src/Logs/PostgresLog.php index e24d73c2..dfb75792 100644 --- a/src/Logs/PostgresLog.php +++ b/src/Logs/PostgresLog.php @@ -21,8 +21,6 @@ protected function fillMatches(array $matches = []): void public static function parseDatetime(?string $datetime): ?CarbonInterface { - $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')); - - return isset($datetime) ? Carbon::createFromFormat('Y-m-d H:i:s.u T', $datetime, $timezone) : null; + return isset($datetime) ? Carbon::createFromFormat('Y-m-d H:i:s.u T', $datetime) : null; } } diff --git a/src/Logs/SupervisorLog.php b/src/Logs/SupervisorLog.php index b83c597e..5780abed 100644 --- a/src/Logs/SupervisorLog.php +++ b/src/Logs/SupervisorLog.php @@ -14,8 +14,6 @@ class SupervisorLog extends Log public static function parseDatetime(?string $datetime): ?CarbonInterface { - $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')); - - return $datetime ? Carbon::createFromFormat('Y-m-d H:i:s,u', $datetime, $timezone) : null; + return $datetime ? Carbon::createFromFormat('Y-m-d H:i:s,u', $datetime) : null; } } From d43a83c21ba66196b6f30f7161889fdfd7d973ea Mon Sep 17 00:00:00 2001 From: luanfreitasdev Date: Tue, 13 Feb 2024 18:40:37 -0300 Subject: [PATCH 18/21] fix postgress test --- src/Logs/HorizonLog.php | 3 ++- src/Logs/HorizonOldLog.php | 2 +- src/Logs/HttpAccessLog.php | 2 +- src/Logs/HttpApacheErrorLog.php | 2 +- src/Logs/HttpNginxErrorLog.php | 2 +- src/Logs/Log.php | 2 +- tests/Unit/PostgresLogs/PostgresLogTest.php | 6 +++--- 7 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/Logs/HorizonLog.php b/src/Logs/HorizonLog.php index b91afa0e..4e37cf56 100644 --- a/src/Logs/HorizonLog.php +++ b/src/Logs/HorizonLog.php @@ -21,7 +21,8 @@ protected function fillMatches(array $matches = []): void { $datetime = $this->parseDateTime($matches['datetime'] ?? null); $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')); - $this->datetime = $timezone ? $datetime->setTimezone($timezone) : $datetime; + $this->datetime = $datetime?->setTimezone($timezone); + $this->level = $matches['level']; $this->message = $matches['message']; $this->context = array_filter([ diff --git a/src/Logs/HorizonOldLog.php b/src/Logs/HorizonOldLog.php index 348f860d..63072338 100644 --- a/src/Logs/HorizonOldLog.php +++ b/src/Logs/HorizonOldLog.php @@ -20,7 +20,7 @@ protected function fillMatches(array $matches = []): void { $datetime = static::parseDateTime($matches['datetime'] ?? null); $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')); - $this->datetime = $timezone ? $datetime->setTimezone($timezone) : $datetime; + $this->datetime = $datetime?->setTimezone($timezone); $this->level = $matches['level']; $this->message = $matches['message']; diff --git a/src/Logs/HttpAccessLog.php b/src/Logs/HttpAccessLog.php index 1901a1a0..ad5b406b 100644 --- a/src/Logs/HttpAccessLog.php +++ b/src/Logs/HttpAccessLog.php @@ -36,7 +36,7 @@ protected function fillMatches(array $matches = []): void $datetime = static::parseDateTime($matches['datetime'] ?? null); $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')); - $this->datetime = $timezone ? $datetime->setTimezone($timezone) : $datetime; + $this->datetime = $datetime?->setTimezone($timezone); $this->level = $matches['status_code'] ?? null; $this->message = sprintf( diff --git a/src/Logs/HttpApacheErrorLog.php b/src/Logs/HttpApacheErrorLog.php index 9d40386c..7dcb0717 100644 --- a/src/Logs/HttpApacheErrorLog.php +++ b/src/Logs/HttpApacheErrorLog.php @@ -16,7 +16,7 @@ protected function fillMatches(array $matches = []): void { $datetime = static::parseDateTime($matches['datetime'] ?? null); $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')); - $this->datetime = $timezone ? $datetime->setTimezone($timezone) : $datetime; + $this->datetime = $datetime?->setTimezone($timezone); $this->level = $matches['level'] ?? null; $this->message = $matches['message'] ?? null; diff --git a/src/Logs/HttpNginxErrorLog.php b/src/Logs/HttpNginxErrorLog.php index 2dff8d79..6b43f9bc 100644 --- a/src/Logs/HttpNginxErrorLog.php +++ b/src/Logs/HttpNginxErrorLog.php @@ -16,7 +16,7 @@ protected function fillMatches(array $matches = []): void { $datetime = static::parseDateTime($matches['datetime'] ?? null); $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')); - $this->datetime = $timezone ? $datetime->setTimezone($timezone) : $datetime; + $this->datetime = $datetime?->setTimezone($timezone); $this->level = $matches['level'] ?? null; $this->message = $matches['errormessage'] ?? null; diff --git a/src/Logs/Log.php b/src/Logs/Log.php index 657e7932..60a1e9b5 100644 --- a/src/Logs/Log.php +++ b/src/Logs/Log.php @@ -106,7 +106,7 @@ protected function fillMatches(array $matches = []): void { $datetime = static::parseDateTime($matches['datetime'] ?? null); $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')); - $this->datetime = $timezone ? $datetime->setTimezone($timezone) : $datetime; + $this->datetime = $datetime?->setTimezone($timezone); $this->level = $matches[static::$regexLevelKey] ?? null; $this->message = trim($matches[static::$regexMessageKey] ?? null); diff --git a/tests/Unit/PostgresLogs/PostgresLogTest.php b/tests/Unit/PostgresLogs/PostgresLogTest.php index 4b20c233..bb4e1a85 100644 --- a/tests/Unit/PostgresLogs/PostgresLogTest.php +++ b/tests/Unit/PostgresLogs/PostgresLogTest.php @@ -31,15 +31,15 @@ $logReader = $file->logs()->scan(); expect($logs = $logReader->get())->toHaveCount(9) - ->and($logs[0]->datetime->toDateTimeString())->toBe('2022-11-26 15:30:59') + ->and($logs[0]->datetime->toDateTimeString())->toBe('2022-11-26 13:30:59') ->and($logs[0]->level)->toBe('CONTEXT') ->and($logs[0]->message)->toBe('PL/pgSQL function inline_code_block line 16 at RAISE') ->and($logs[0]->context['pid'])->toBe(20532) - ->and($logs[1]->datetime->toDateTimeString())->toBe('2022-11-26 15:32:04') + ->and($logs[1]->datetime->toDateTimeString())->toBe('2022-11-26 13:32:04') ->and($logs[1]->level)->toBe('WARNING') ->and($logs[1]->message)->toBe('WELCOME TO') ->and($logs[1]->context['pid'])->toBe(18913) - ->and($logs[2]->datetime->toDateTimeString())->toBe('2022-11-26 15:32:04') + ->and($logs[2]->datetime->toDateTimeString())->toBe('2022-11-26 13:32:04') ->and($logs[2]->level)->toBe('CONTEXT') ->and($logs[2]->message)->toBe('PL/pgSQL function inline_code_block line 16 at RAISE') ->and($logs[2]->context['pid'])->toBe(18913); From 37f458d028b81fea549f75271add467550e7cc05 Mon Sep 17 00:00:00 2001 From: luanfreitasdev Date: Tue, 13 Feb 2024 18:48:13 -0300 Subject: [PATCH 19/21] Fix default UTC setTimezone --- src/Logs/HorizonLog.php | 2 +- src/Logs/HorizonOldLog.php | 2 +- src/Logs/HttpAccessLog.php | 2 +- src/Logs/HttpApacheErrorLog.php | 2 +- src/Logs/HttpNginxErrorLog.php | 2 +- src/Logs/Log.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Logs/HorizonLog.php b/src/Logs/HorizonLog.php index 4e37cf56..080a5ad4 100644 --- a/src/Logs/HorizonLog.php +++ b/src/Logs/HorizonLog.php @@ -20,7 +20,7 @@ class HorizonLog extends Log protected function fillMatches(array $matches = []): void { $datetime = $this->parseDateTime($matches['datetime'] ?? null); - $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')); + $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')) ?? 'UTC'; $this->datetime = $datetime?->setTimezone($timezone); $this->level = $matches['level']; diff --git a/src/Logs/HorizonOldLog.php b/src/Logs/HorizonOldLog.php index 63072338..a714e4f2 100644 --- a/src/Logs/HorizonOldLog.php +++ b/src/Logs/HorizonOldLog.php @@ -19,7 +19,7 @@ class HorizonOldLog extends Log protected function fillMatches(array $matches = []): void { $datetime = static::parseDateTime($matches['datetime'] ?? null); - $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')); + $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')) ?? 'UTC'; $this->datetime = $datetime?->setTimezone($timezone); $this->level = $matches['level']; diff --git a/src/Logs/HttpAccessLog.php b/src/Logs/HttpAccessLog.php index ad5b406b..dc9f8765 100644 --- a/src/Logs/HttpAccessLog.php +++ b/src/Logs/HttpAccessLog.php @@ -35,7 +35,7 @@ protected function fillMatches(array $matches = []): void ]; $datetime = static::parseDateTime($matches['datetime'] ?? null); - $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')); + $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')) ?? 'UTC'; $this->datetime = $datetime?->setTimezone($timezone); $this->level = $matches['status_code'] ?? null; diff --git a/src/Logs/HttpApacheErrorLog.php b/src/Logs/HttpApacheErrorLog.php index 7dcb0717..c4932541 100644 --- a/src/Logs/HttpApacheErrorLog.php +++ b/src/Logs/HttpApacheErrorLog.php @@ -15,7 +15,7 @@ class HttpApacheErrorLog extends Log protected function fillMatches(array $matches = []): void { $datetime = static::parseDateTime($matches['datetime'] ?? null); - $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')); + $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')) ?? 'UTC'; $this->datetime = $datetime?->setTimezone($timezone); $this->level = $matches['level'] ?? null; diff --git a/src/Logs/HttpNginxErrorLog.php b/src/Logs/HttpNginxErrorLog.php index 6b43f9bc..4e4e1fc6 100644 --- a/src/Logs/HttpNginxErrorLog.php +++ b/src/Logs/HttpNginxErrorLog.php @@ -15,7 +15,7 @@ class HttpNginxErrorLog extends Log protected function fillMatches(array $matches = []): void { $datetime = static::parseDateTime($matches['datetime'] ?? null); - $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')); + $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')) ?? 'UTC'; $this->datetime = $datetime?->setTimezone($timezone); $this->level = $matches['level'] ?? null; diff --git a/src/Logs/Log.php b/src/Logs/Log.php index 60a1e9b5..203c12e9 100644 --- a/src/Logs/Log.php +++ b/src/Logs/Log.php @@ -105,7 +105,7 @@ protected function parseText(array &$matches = []): void protected function fillMatches(array $matches = []): void { $datetime = static::parseDateTime($matches['datetime'] ?? null); - $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')); + $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')) ?? 'UTC'; $this->datetime = $datetime?->setTimezone($timezone); $this->level = $matches[static::$regexLevelKey] ?? null; From 04c0a04b96da9ddeca60de3fad52fa2aa78d1ff9 Mon Sep 17 00:00:00 2001 From: luanfreitasdev Date: Wed, 14 Feb 2024 09:04:49 -0300 Subject: [PATCH 20/21] Fixing more Datetime timezone --- src/Logs/LaravelLog.php | 4 +++- src/Logs/Log.php | 5 ++++- tests/Unit/LogTest.php | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Logs/LaravelLog.php b/src/Logs/LaravelLog.php index 4a524ff6..cfe60deb 100644 --- a/src/Logs/LaravelLog.php +++ b/src/Logs/LaravelLog.php @@ -38,7 +38,9 @@ protected function parseText(array &$matches = []): void preg_match(static::regexPattern(), array_shift($firstLineSplit), $matches); - $this->datetime = Carbon::parse($matches[1], config('log-viewer.timezone', config('app.timezone', 'UTC'))); + $this->datetime = Carbon::parse($matches[1])?->setTimezone( + config('log-viewer.timezone', config('app.timezone', 'UTC')) ?? 'UTC' + ); // $matches[2] contains microseconds, which is already handled // $matches[3] contains timezone offset, which is already handled diff --git a/src/Logs/Log.php b/src/Logs/Log.php index 203c12e9..5a82e671 100644 --- a/src/Logs/Log.php +++ b/src/Logs/Log.php @@ -67,7 +67,10 @@ public static function matches(string $text, ?int &$timestamp = null, ?string &$ if ($result) { try { - $timestamp = static::parseDateTime($matches[static::$regexDatetimeKey] ?? null)?->timestamp; + $datetime = static::parseDateTime($matches[static::$regexDatetimeKey] ?? null); + $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')) ?? 'UTC'; + $timestamp = $datetime?->setTimezone($timezone)->timestamp; + $level = $matches[static::$regexLevelKey] ?? ''; } catch (\Exception $exception) { // not a valid datetime, so we can't match this log. Perhaps it's a different but similar log type. diff --git a/tests/Unit/LogTest.php b/tests/Unit/LogTest.php index ef2270d2..feb8f089 100644 --- a/tests/Unit/LogTest.php +++ b/tests/Unit/LogTest.php @@ -167,7 +167,7 @@ $log = new LaravelLog($text, 'laravel.log', 0, 0); assertEquals($tz, $log->datetime->timezoneName); - $expectedTime = \Carbon\Carbon::parse('2022-11-07 17:51:33', $tz)->toDateTimeString(); + $expectedTime = \Carbon\Carbon::parse('2022-11-07 17:51:33', 'UTC')->setTimezone($tz)->toDateTimeString(); assertEquals($expectedTime, $log->datetime->toDateTimeString()); }); From 27cffd5b6db004eb1b532dc64d8d1ca97d8a039e Mon Sep 17 00:00:00 2001 From: luanfreitasdev Date: Wed, 14 Feb 2024 11:13:59 -0300 Subject: [PATCH 21/21] Fix parseDateTime in Log class --- src/Logs/Log.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Logs/Log.php b/src/Logs/Log.php index 5a82e671..af49c8b3 100644 --- a/src/Logs/Log.php +++ b/src/Logs/Log.php @@ -107,7 +107,7 @@ protected function parseText(array &$matches = []): void protected function fillMatches(array $matches = []): void { - $datetime = static::parseDateTime($matches['datetime'] ?? null); + $datetime = static::parseDateTime($matches[static::$regexDatetimeKey] ?? null); $timezone = config('log-viewer.timezone', config('app.timezone', 'UTC')) ?? 'UTC'; $this->datetime = $datetime?->setTimezone($timezone);