示例#1
0
 private function errorReportingLevel()
 {
     $notifySeverities = empty($this->notifySeverities) ? self::$DEFAULT_NOTIFY_SEVERITIES : $this->notifySeverities;
     $level = 0;
     $severities = explode(",", $notifySeverities);
     foreach ($severities as $severity) {
         $level |= Bugsnag_ErrorTypes::getLevelsForSeverity($severity);
     }
     return $level;
 }
示例#2
0
文件: Error.php 项目: azonwan/pingju
 public function setPHPError($code, $message, $file, $line, $fatal = false)
 {
     if ($fatal) {
         // Generating stacktrace for PHP fatal errors is not possible,
         // since this code executes when the PHP process shuts down,
         // rather than at the time of the crash.
         //
         // In these situations, we generate a "stacktrace" containing only
         // the line and file number where the crash occurred.
         $stacktrace = Bugsnag_Stacktrace::fromFrame($this->config, $file, $line);
     } else {
         $stacktrace = Bugsnag_Stacktrace::generate($this->config);
     }
     $this->setName(Bugsnag_ErrorTypes::getName($code))->setMessage($message)->setSeverity(Bugsnag_ErrorTypes::getSeverity($code))->setStacktrace($stacktrace)->setCode($code);
     return $this;
 }
示例#3
0
 public function shutdownHandler()
 {
     // Get last error
     $lastError = error_get_last();
     // Check if a fatal error caused this shutdown
     if (!is_null($lastError) && Bugsnag_ErrorTypes::isFatal($lastError['type']) && $this->config->autoNotify && !$this->config->shouldIgnoreErrorCode($lastError['type'])) {
         $error = Bugsnag_Error::fromPHPError($this->config, $this->diagnostics, $lastError['type'], $lastError['message'], $lastError['file'], $lastError['line'], true);
         $error->setSeverity("error");
         $this->notify($error);
     }
     // Flush any buffered errors
     if ($this->notification) {
         $this->notification->deliver();
         $this->notification = null;
     }
 }
 public function testGetLevelsForSeverity()
 {
     $this->assertEquals(Bugsnag_ErrorTypes::getLevelsForSeverity("error"), 4437);
     $this->assertEquals(Bugsnag_ErrorTypes::getLevelsForSeverity("warning"), 674);
     $this->assertEquals(Bugsnag_ErrorTypes::getLevelsForSeverity("info"), 27656);
 }