Skip to content

Commit

Permalink
Cleanup, PHP 8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
leowebguy committed Mar 24, 2023
1 parent f845e26 commit 0f27a27
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/services/LoggerService.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,17 @@ public function handleException($exception): void
*/
public function writeException($data): void
{
$path = Craft::$app->path->getLogPath();

$logfile = 'simplelogger.json';
$logfile = Craft::$app->path->getLogPath() . '/simplelogger.json';

if (!@file_exists($path . '/' . $logfile)) {
@file_put_contents($path . '/' . $logfile, '[]');
if (!@file_exists($logfile)) {
@file_put_contents($logfile, '[]');
}

$json = @file_get_contents($path . '/' . $logfile);
$json = @file_get_contents($logfile);

$array = Json::decode($json);
$array[] = $data;
@file_put_contents($path . '/' . $logfile, Json::encode($array));
@file_put_contents($logfile, Json::encode($array));
}

/**
Expand Down

0 comments on commit 0f27a27

Please sign in to comment.