初始化sentry

324 阅读1分钟

thinkphp/library/think/App.php

    public function initialize()
    {
       $this->initSentry();
    }
   /**
     * 初始化sentry
     */
    public function initSentry()
    {
        $domain = $this->request->domain();

        $sys = 'cli';
        
        if (strpos($domain, 'sports') !== false) {
            session('sys', 'sports');
            $sys = 'sports';
        }

        if (\think\facade\Env::get('APP_ENV') == 'test') {
            \Sentry\init(['dsn' => 'http://dd2c004sdfasfe839c202ce8b4a3503801e046e@sentry-dev.owenzhang.cn/6']);
        } elseif (\think\facade\Env::get('APP_ENV') == 'prod') {
            if ($sys == 343) {
                \Sentry\init(['dsn' => 'http://3aa38ce999114ceebe78c60f8da4a189@sentry-dev.owen.cn/8']);
            } elseif ($sys == 'sports') {
                \Sentry\init(['dsn' => 'http://b260c1b8fff7dac20c424ab04f82ebbf@sentry-dev.zhang.cn/11']);
            } 
        }
    }

Buy me a cup of coffee :)