繁体   English   中英

Laravel 哨兵设置环境

[英]Laravel sentry set environment

我正在为我的项目设置哨兵,我目前有 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 键?

如果您在本地将SENTRY_DSN=设置为 null 或将其删除,它将永远不会发送出去,因为 DSN 丢失,因此无处可发送。

https://docs.sentry.io/platforms/php/laravel/#local-development

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM