Exemple #1
0
 public function update(\SplSubject $subject, $isException = false)
 {
     if (!$isException) {
         $error = $subject->getError();
         $typeLog = $error->code == 'E_FATAL' ? 'fatal' : 'error';
         Logger::getInstance()->{$typeLog}(ucfirst($error->type) . ' : ' . $error->message . ' in ' . $error->file . ' on line ' . $error->line, 'error');
     } else {
         $exception = $subject->getException();
         Logger::getInstance()->fatal('Exception' . ' : "' . $exception->message . '" in ' . $exception->file . ' on line ' . $exception->line . ' with trace : ' . chr(10) . $exception->trace, 'error');
     }
 }
 /**
  * Mail the sysadmin with Exception information.
  *
  * @param    SplSubject $subject   The ExceptionHandler
  * @return   bool
  */
 public function update(SplSubject $subject)
 {
     $exception = $subject->getException();
     // perhaps emailer also would like to know the server in question
     $output = 'Server: ' . $_SERVER['HOSTNAME'] . PHP_EOL;
     $output .= 'File: ' . $exception->getFile() . PHP_EOL;
     $output .= 'Line: ' . $exception->getLine() . PHP_EOL;
     $output .= 'Message: ' . PHP_EOL . $exception->getMessage() . PHP_EOL;
     $output .= 'Stack Trace:' . PHP_EOL . $exception->getTraceAsString() . PHP_EOL;
     $headers = 'From: webmaster@yourdomain.com' . "\r\n" . 'Reply-To: webmaster@yourdomain.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
     echo "\n\nThe following email (would be) sent to your webmaster@yourdomain.com:\n\n";
     echo $output;
     //return mail('*****@*****.**', 'Exception Thrown', $output, $headers);
 }
Exemple #3
0
 /**
  * Update the error_log with
  * information about the Exception.
  *
  * @param SplSubject $subject   The ExceptionHandler
  * @return boolean
  */
 public function update(SplSubject $subject)
 {
     return error_log($subject->getException(), 0, $this->filename);
 }