From 3b4e9675dddd9033ae0a72129eb7cb09e3b859c0 Mon Sep 17 00:00:00 2001 From: Jakub Onderka Date: Mon, 15 Apr 2024 21:53:09 +0200 Subject: [PATCH] new: [internal] Send more logs to sentry as breadcrumbs --- app/Model/AppModel.php | 2 +- app/Model/Log.php | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Model/AppModel.php b/app/Model/AppModel.php index 738c4d3d8..12816afb5 100644 --- a/app/Model/AppModel.php +++ b/app/Model/AppModel.php @@ -3825,7 +3825,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)); } diff --git a/app/Model/Log.php b/app/Model/Log.php index 2155a2e99..ec8d59711 100644 --- a/app/Model/Log.php +++ b/app/Model/Log.php @@ -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'],