Merge pull request #9686 from JakubOnderka/sentry-breadcrumb

new: [internal] Send more logs to sentry as breadcrumbs
pull/7010/merge
Jakub Onderka 2024-04-20 13:38:02 +02:00 committed by GitHub
commit c0572af7dc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View File

@ -3828,7 +3828,7 @@ class AppModel extends Model
protected function logException($message, Exception $exception, $type = LOG_ERR)
{
// If Sentry is installed, send exception to Sentry
if (function_exists('\Sentry\captureException') && $type === LOG_ERR) {
if (function_exists('\Sentry\captureException') && $type <= LOG_ERR) {
\Sentry\captureException(new Exception($message, $type, $exception));
}

View File

@ -259,6 +259,11 @@ class Log extends AppModel
$change = implode(", ", $output);
}
// If Sentry is installed, send log breadcrumb to Sentry
if (function_exists('\Sentry\addBreadcrumb')) {
\Sentry\addBreadcrumb('log', $title, [], Sentry\Breadcrumb::LEVEL_INFO);
}
$this->create();
$result = $this->save(['Log' => [
'org' => $user['Organisation']['name'],