Skip to content

Commit

Permalink
V1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
fr3on committed Apr 5, 2023
1 parent 98067e6 commit ae472d8
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/Sleuren.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public function getExceptionData(Throwable $exception)
$data['line'] = $exception->getLine();
$data['file'] = $exception->getFile();
$data['class'] = get_class($exception);
$data['release'] = trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD'));
$data['release'] = $this->command('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD');

$data['storage'] = [
'SERVER' => [
Expand All @@ -175,14 +175,17 @@ public function getExceptionData(Throwable $exception)
'OS_NAME' => php_uname('s'),
'OS_VERSION' => php_uname('r'),
'OS_ARCH' => php_uname('m'),
'FRAMEWORK' => [
'name' => 'Laravel',
'version' => app()->version(),
],
],
'PACKAGES' => $this->getComposerPackages(),
'FRAMEWORK' => [
'name' => 'Laravel',
'version' => app()->version(),
],
'SDK' => [
'name' => 'sleuren/laravel',
'version' => '1.0.1',
],
'COMPOSER_PACKAGES' => $this->getComposerPackages(),
'NPM_PACKAGES' => $this->getNpmPackages(),
'packagesCount' => count($this->getComposerPackages() + $this->getNpmPackages()),
'GIT' => $this->getGitInfo(),
'OLD' => $this->filterVariables(Request::hasSession() ? Request::old() : []),
'COOKIE' => $this->filterVariables(Request::cookie()),
Expand All @@ -192,7 +195,6 @@ public function getExceptionData(Throwable $exception)
];

$data['storage'] = array_filter($data['storage']);

$count = 5;
$lines = file($data['file']);
$data['executor'] = [];
Expand All @@ -206,8 +208,7 @@ public function getExceptionData(Throwable $exception)
}
$data['executor'] = array_filter($data['executor']);

// Get project version
$data['project_version'] = shell_exec("git log -1 --pretty=format:'%h' --abbrev-commit");
$data['project_version'] = $this->command("git log -1 --pretty=format:'%h' --abbrev-commit");

// to make symfony exception more readable
if ($data['class'] == 'Symfony\Component\Debug\Exception\FatalErrorException') {
Expand Down Expand Up @@ -381,7 +382,7 @@ private function getGitInfo()
];
return $git;
} catch (\Exception $e) {
return 'unknown';
return [];
}
}

Expand Down

0 comments on commit ae472d8

Please sign in to comment.