【发布时间】:2020-03-10 09:21:05
【问题描述】:
我正在为我的项目设置哨兵,我目前有 3 个本地环境、暂存环境和生产环境。
我只想将其设置为哨兵跟踪登台和制作,我们完全忽略本地,但通过查看文档我没有找到任何帮助我的东西。
处理方法
此方法直接取自文档并添加到我的处理程序方法中
public function report(Exception $exception)
{
if (app()->bound('sentry') && $this->shouldReport($exception)) {
app('sentry')->captureException($exception);
}
parent::report($exception);
}
哨兵配置
return [
'dsn' => env('SENTRY_LARAVEL_DSN', env('SENTRY_DSN')),
// capture release as git sha
// 'release' => trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')),
'breadcrumbs' => [
// Capture Laravel logs in breadcrumbs
'logs' => true,
// Capture SQL queries in breadcrumbs
'sql_queries' => true,
// Capture bindings on SQL queries logged in breadcrumbs
'sql_bindings' => true,
// Capture queue job information in breadcrumbs
'queue_info' => true,
],
];
环境文件
SENTRY_DSN=dsdsdsds
有人对如何设置它以跟踪某些环境有任何指导吗?我是否需要设置任何额外的 env 键?
【问题讨论】: