Esempio n. 1
0
 /**
  * Listens for exception events, and automatically logs them.
  *
  * @param Exception $e
  */
 function exception($e)
 {
     $logLevel = \Psr\Log\LogLevel::CRITICAL;
     if ($e instanceof \Sabre\DAV\Exception) {
         // If it's a standard sabre/dav exception, it means we have a http
         // status code available.
         $code = $e->getHTTPCode();
         if ($code >= 400 && $code < 500) {
             // user error
             $logLevel = \Psr\Log\LogLevel::INFO;
         } else {
             // Server-side error. We mark it's as an error, but it's not
             // critical.
             $logLevel = \Psr\Log\LogLevel::ERROR;
         }
     }
     $this->server->getLogger()->log($logLevel, 'Uncaught exception', ['exception' => $e]);
 }