/** * 构造方法 * @param string $message * @param int $code * @param array $info */ public function __construct($message = "", $code = 0, $info = array()) { parent::__construct($message, $code); $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); $trace['message'] = $message; $trace['code'] = $code; LogUtil::write($trace, str_replace('\\', '_', get_class($this)), Logger::ERROR); }
/** * 对未捕捉的异常进行捕捉处理 * @param \Exception $e */ public static function handlerException(\Exception $e) { $msg['message'] = $e->getMessage(); $msg['file'] = $e->getFile() . '#' . $e->getLine(); $msg['exception'] = get_class($e); $msg['line'] = __LINE__; try { LogUtil::write($msg, 'uncatch', Logger::ERROR); } catch (\Exception $ecp) { echo '<p style="color:red;"><b>' . $ecp->getMessage() . '</b></p>'; //$ecp->getMessage(); exit; } }