package cn.rest.advice;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import cn.rest.exception.BaseException;
/**
*
* 〈一句话功能简述〉<br>
* 统一异常处理--将异常打印到日志
*
*/
@ControllerAdvice
public class GlobalExceptionLog {
private final Logger logger = LoggerFactory.getLogger(GlobalExceptionLog.class);
@ExceptionHandler(BaseException.class)
public void exceptionHandler(BaseException e, HttpServletResponse response) {
logger.error(e.getMessage(),e);
}
}