TP5的日志如果没有特别设置的话,只要出现错误就会记录在日志文件中。这种是没有做必要的,因为这样的话,LOG文件会特别大,而且有好多都是没有用的信息。下面我们对LOG日志进行改造只记录我们需要的信息。
还记得上一章中,异常封装中。看记录日志出现的位置,我们只记录未知错误,而一些用户引起的一些参数错误 ,我们在这里不记录。
class ExceptionHandler extends Handle
{
private $code;
private $msg;
private $errorCode;
public function render(Exception KaTeX parse error: Expected '}', got 'EOF' at end of input: e) { if(e instanceof BaseException){ //是否为BaseException继承类
t h i s − > c o d e = this->code = this−>code=e ->code;
t h i s − > m s g = this->msg = this−>