Skip to content

Commit

Permalink
Fix default UTC setTimezone
Browse files Browse the repository at this point in the history
  • Loading branch information
luanfreitasdev committed Feb 13, 2024
1 parent d43a83c commit 37f458d
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Logs/HorizonLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down
2 changes: 1 addition & 1 deletion src/Logs/HorizonOldLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down
2 changes: 1 addition & 1 deletion src/Logs/HttpAccessLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Logs/HttpApacheErrorLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Logs/HttpNginxErrorLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Logs/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 37f458d

Please sign in to comment.