當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Handler::report方法代碼示例

本文整理匯總了PHP中Illuminate\Foundation\Exceptions\Handler::report方法的典型用法代碼示例。如果您正苦於以下問題:PHP Handler::report方法的具體用法?PHP Handler::report怎麽用?PHP Handler::report使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Foundation\Exceptions\Handler的用法示例。


在下文中一共展示了Handler::report方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: report

 /**
  * Report or log an exception.
  *
  * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
  *
  * @param  \Exception  $e
  * @return void
  */
 public function report(Exception $e)
 {
     if (app()->environment('production')) {
         app(ErrorReporting::class)->send($e);
     }
     return parent::report($e);
 }
開發者ID:valdinei,項目名稱:rest,代碼行數:15,代碼來源:Handler.php

示例2: report

 /**
  * Report or log an exception.
  *
  * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
  *
  * @param \Exception $e
  *
  * @return void
  */
 public function report(Exception $e)
 {
     if ($this->shouldReport($e) && app()->bound('bugsnag')) {
         app('bugsnag')->notifyException($e, null, 'error');
     }
     return parent::report($e);
 }
開發者ID:xing393939,項目名稱:Laravel-5-Bootstrap-3-Starter-Site,代碼行數:16,代碼來源:BugsnagExceptionHandler.php

示例3: report

 /**
  * Report or log an exception.
  *
  * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
  *
  * @param  \Exception  $e
  * @return void
  */
 public function report(Exception $e)
 {
     if (!config('app.debug') && $this->shouldReport($e)) {
         if ($this->isHttpException($e)) {
             $status_code = $e->getStatusCode();
         } else {
             $status_code = $e->getCode();
         }
         Cache::remember('suppress-error-notification:' . $status_code . ':' . $e->getFile() . ':' . $e->getLine(), Carbon::now()->addHours(config('sns-error-notification.cache-hours')), function () use($e, $status_code) {
             // Build the "trace" variable
             if (method_exists($e, 'getTrace')) {
                 $all_trace = $e->getTrace();
                 $trace_items = [];
                 foreach ($all_trace as $item) {
                     $trace_items[] = "    " . json_encode($item);
                 }
                 if (count($trace_items)) {
                     $trace = implode("\n\n", $trace_items);
                 } else {
                     $trace = '(No trace data)';
                 }
             } else {
                 $trace = '(exception does not have a trace method)';
             }
             $message = $e->getMessage();
             if (!$message) {
                 $message = "Error in " . $e->getFile();
             }
             $sns = AWS::createClient('sns');
             $result = $sns->publish(['Message' => "URL: " . Request::fullUrl() . "\n" . "Method: " . Request::method() . "\n" . "Message: " . $message . "\n" . "Error Code: " . $status_code . "\n" . "File: " . $e->getFile() . "\n" . "Line: " . $e->getLine() . "\n\n" . "User ID: " . (auth()->check() ? auth()->User()->id : 'Guest') . "\n\n" . "Session: " . json_encode(session()->all()) . "\n\n" . "Request: " . json_encode(request()->all()) . "\n\n" . "Trace: " . $trace, 'Subject' => config('sns-error-notification.notification-subject'), 'TopicArn' => config('sns-error-notification.sns-topic')]);
             return true;
         });
     }
     return parent::report($e);
 }
開發者ID:jdavidbakr,項目名稱:laravel-sns-error-notification,代碼行數:43,代碼來源:ErrorNotifier.php

示例4: report

 /**
  * Report or log an exception.
  *
  * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
  *
  * @param  \Exception  $e
  * @return void
  */
 public function report(Exception $e)
 {
     if ($this->shouldReport($e)) {
         Log::error($e);
     }
     parent::report($e);
 }
開發者ID:webfactorybulgaria,項目名稱:Base,代碼行數:15,代碼來源:Handler.php

示例5: report

 /**
  * Report or log an exception.
  *
  * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
  *
  * @param  \Exception  $e
  * @return void
  */
 public function report(Exception $e)
 {
     if ($e instanceof QueryException) {
         return "teste";
     }
     return parent::report($e);
 }
開發者ID:GabrielDvt,項目名稱:laravel2,代碼行數:15,代碼來源:Handler.php

示例6: report

 /**
  * Report or log an exception.
  *
  * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
  *
  * @param  \Exception  $e
  * @return void
  */
 public function report(Exception $e)
 {
     if ($this->shouldReport($e) && app()->environment() == 'local') {
         $this->mailer->getSwiftMailer()->send(SwiftMessage::newInstance(null)->addTo('log@localhost')->addFrom('noreply@localhost', 'Laravel Drydock')->setBody($this->render(null, $e)->getContent())->setContentType('text/html'));
     }
     parent::report($e);
 }
開發者ID:atrauzzi,項目名稱:laravel-drydock,代碼行數:15,代碼來源:Handler.php

示例7: report

 /**
  * Report or log an exception.
  *
  * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
  *
  * @param  \Exception  $e
  * @return void
  */
 public function report(Exception $e)
 {
     /*if ($this->shouldReport($e)) {
           app('sentry')->captureException($e);
       }*/
     parent::report($e);
 }
開發者ID:davila7,項目名稱:kayra,代碼行數:15,代碼來源:Handler.php

示例8: report

 /**
  * Report or log an exception.
  *
  * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
  *
  * @param  \Exception  $exception
  */
 public function report(Exception $exception)
 {
     if ($this->shouldReport($exception)) {
         app('sentry')->captureException($exception);
     }
     return parent::report($exception);
 }
開發者ID:suitmedia,項目名稱:suitcoda,代碼行數:14,代碼來源:Handler.php

示例9: report

 /**
  * Report or log an exception.
  *
  * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
  *
  * @param  \Exception  $e
  * @return void
  */
 public function report(Exception $e)
 {
     if ($e instanceof VerifyCsrfToken) {
         Log::error('CSRF Error', ['exception' => $e, 'url' => URL::current()]);
     }
     return parent::report($e);
 }
開發者ID:jeroenhekihenk,項目名稱:video-platform,代碼行數:15,代碼來源:Handler.php

示例10: report

 /**
  * Report or log an exception.
  *
  * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
  *
  * @param  \Exception  $e
  * @return void
  */
 public function report(Exception $e)
 {
     if (config('app.debug') && $e instanceof DevBaseException) {
         //TODO not sure what to do with custom exception, temporarily using system error pages.
     }
     return parent::report($e);
 }
開發者ID:straysh,項目名稱:straysh.info,代碼行數:15,代碼來源:Handler.php

示例11: report

 /**
  * Report or log an exception.
  *
  * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
  *
  * @param  \Exception  $e
  * @return void
  */
 public function report(Exception $e)
 {
     if (strtolower(getenv('SLACK_ENABLE')) === 'true') {
         Slack::send("Exception: {$e->getMessage()} on file {$e->getFile()} at line {$e->getLine()}");
     }
     return parent::report($e);
 }
開發者ID:katzumi,項目名稱:talent4startups,代碼行數:15,代碼來源:Handler.php

示例12: report

 public function report(Exception $e)
 {
     if ($this->shouldReport($e)) {
         app('bugvel')->send($e);
     }
     return parent::report($e);
 }
開發者ID:bugvel,項目名稱:bugvel,代碼行數:7,代碼來源:BugvelExceptionHandler.php

示例13: report

 /**
  * Report or log an exception.
  *
  * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
  *
  * @param  \Exception  $e
  * @return void
  */
 public function report(Exception $e)
 {
     if ($e instanceof ModelNotFoundException) {
         abort(404);
     }
     return parent::report($e);
 }
開發者ID:belhard-user,項目名稱:group2,代碼行數:15,代碼來源:Handler.php

示例14: report

 /**
  * Report or log an exception.
  *
  * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
  *
  * @param  \Exception  $e
  * @return void
  */
 public function report(Exception $e)
 {
     if (self::shouldReport($e)) {
         TraceToSlack::trace($e);
     }
     return parent::report($e);
 }
開發者ID:lfelin,項目名稱:laravel-tracetoslack,代碼行數:15,代碼來源:TraceToSlackHandler.php

示例15: report

 /**
  * Report or log an exception.
  *
  * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
  *
  * @param  \Exception  $e
  * @return void
  */
 public function report(Exception $e)
 {
     if (!config('app.debug')) {
         Log::error($e);
     }
     return parent::report($e);
 }
開發者ID:dereckson,項目名稱:imgubox,代碼行數:15,代碼來源:Handler.php


注:本文中的Illuminate\Foundation\Exceptions\Handler::report方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。