Пример #1
0
 public static function handler($exception)
 {
     if ($exception instanceof Exception) {
         $debugging = defined('IS_DEBUGGING') ? IS_DEBUGGING : false;
         $production = defined('IS_PRODUCTION') ? IS_PRODUCTION : false;
         if (true == $debugging) {
             if (true == $production) {
                 LJL_Log::write(API_String::clean($exception), LJL_Log::TYPE_EXCEPTION);
             } else {
                 echo LJL_Request::resolveType() == LJL_Request::CLI ? API_String::clean($exception) : $exception;
             }
         } else {
             header('location: ' . SYSTEM_HOMEPAGE);
         }
     }
 }
Пример #2
0
 public static function handler($level, $errorMsg, $file, $line, $context = null)
 {
     if ('.tpl.php' == substr($file, -8)) {
         return;
     }
     $str = new LJL_Exception($errorMsg, $level, $file, $line);
     $debugging = IS_DEBUGGING;
     $production = IS_PRODUCTION;
     if ($debugging) {
         $content = "<br />\n<h2>Error Info:</h2>\n" . '<b>MESSAGE:</b> ' . $errorMsg . "<br />\n" . '<b>TYPE:</b> ' . (isset(self::$levels[$level]) ? self::$levels[$level] : $level) . "<br />\n" . '<b>FILE:</b> ' . $file . "<br />\n" . '<b>LINE:</b> ' . $line . "<br />\n" . $str;
         if ($production) {
             LJL_Log::write(API_String::clean($content), LJL_Log::TYPE_ERROR);
         } else {
             echo LJL_Request::resolveType() == LJL_Request::CLI ? API_String::clean($content) : $content;
         }
     }
 }