diff --git a/src/Sentry/SentryLaravel/SentryLaravelServiceProvider.php b/src/Sentry/SentryLaravel/SentryLaravelServiceProvider.php index fcff0d20..bdb90867 100644 --- a/src/Sentry/SentryLaravel/SentryLaravelServiceProvider.php +++ b/src/Sentry/SentryLaravel/SentryLaravelServiceProvider.php @@ -86,16 +86,18 @@ public function register() 'app_path' => app_path(), ), $user_config)); - // bind user context if available - try { - if ($app['auth']->check()) { - $user = $app['auth']->user(); - $client->user_context(array( - 'id' => $user->getAuthIdentifier(), - )); + if($user_config['breadcrumbs.user_context']) { + // bind user context if available + try { + if ($app['auth']->check()) { + $user = $app['auth']->user(); + $client->user_context(array( + 'id' => $user->getAuthIdentifier(), + )); + } + } catch (\Exception $e) { + error_log(sprintf('sentry.breadcrumbs error=%s', $e->getMessage())); } - } catch (\Exception $e) { - error_log(sprintf('sentry.breadcrumbs error=%s', $e->getMessage())); } return $client; diff --git a/src/config/config.php b/src/config/config.php index a217262a..0024316d 100644 --- a/src/config/config.php +++ b/src/config/config.php @@ -5,4 +5,7 @@ // capture release as git sha // 'release' => trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')), + + // capture user context for breadcrumbs + 'breadcrumbs.user_context' => true, );