<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                ## Sentry [Sentry](https://sentry.io/) 是一個日志平臺,分為客戶端和服務端,客戶端(目前客戶端有Python, PHP,C#, Ruby等多種語言)就嵌入在你的應用程序中間,程序出現異常就向服務端發送消息,服務端將消息記錄到數據庫中并提供一個web節目方便查看。Sentry由python編寫,源碼開放,性能卓越,易于擴展,目前著名的用戶有 Disqus, Path, mozilla, Pinterest 等。 ## 如何接入 首先安裝 Sentry PHP 庫: ~~~ composer require sentry/sdk ~~~ 首先由于?[sentry/sdk](https://packagist.org/packages/sentry/sdk)?是基于 GuzzleHttp 開發的,因為 GuzzleHttp 無法直接在 Swoole 協程中使用,所以需要先安裝 [Mix Guzzle](https://github.com/mix-php/guzzle),該庫能在不修改源碼的情況下讓 GuzzleHttp 協程化。 ~~~ composer require mix/guzzle ~~~ 然后我們查看一下框架錯誤組件的依賴配置: - [manifest/beans/error.php](https://github.com/mix-php/mix-skeleton/blob/master/manifest/beans/error.php) 在配置中我們能看到注入了一個 `dispatcher` 的屬性,是一個事件調度器,而 [mix/console](https://github.com/mix-php/console) 會在每次捕獲到異常的時候調用該調度器,觸發: - `Mix\Console\Event\HandleExceptionEvent::class` 事件:包含一個 `$exception` 的屬性,就是當次拋出的異常對象。 我們首先創建一個監聽器: ~~~ <?php namespace App\Common\Listeners; use Mix\Console\Event\HandleExceptionEvent; use Mix\Event\ListenerInterface; /** * Class ExceptionListener * @package App\Common\Listeners * @author liu,jian <coder.keda@gmail.com> */ class ExceptionListener implements ListenerInterface { /** * 監聽的事件 * @return array */ public function events(): array { // 要監聽的事件數組,可監聽多個事件 return [ HandleExceptionEvent::class, ]; } /** * 處理事件 * @param object $event */ public function process(object $event) { // 事件觸發后,會執行該方法 if (!$event instanceof HandleExceptionEvent) { return; } \Sentry\init(['dsn' => 'https://<key>@<organization>.ingest.sentry.io/<project>' ]); \Sentry\captureException($event->exception); } } ~~~ 然后將監聽器注冊到事件調度器中: - [manifest/beans/event.php#L15](https://github.com/mix-php/mix-skeleton/blob/master/manifest/beans/event.php#L15)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看