public function shutdownHandler() { // Get last error $lastError = error_get_last(); // Check if a fatal error caused this shutdown if (!is_null($lastError) && Wapplogs_ErrorTypes::isFatal($lastError['type'])) { $error = Wapplogs_Error::fromPHPError($this->config, $this->diagnostics, $lastError['type'], $lastError['message'], $lastError['file'], $lastError['line'], true); $error->setSeverity("error"); if (!$error->shouldIgnore() && $this->config->autoNotify) { $this->notify($error); } } // Flush any buffered errors if ($this->notification) { $this->notification->deliver(); $this->notification = null; } }
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 = Wapplogs_Stacktrace::fromFrame($this->config, $file, $line); } else { $stacktrace = Wapplogs_Stacktrace::generate($this->config); } $this->setName(Wapplogs_ErrorTypes::getName($code))->setMessage($message)->setSeverity(Wapplogs_ErrorTypes::getSeverity($code))->setStacktrace($stacktrace)->setCode($code); return $this; }