mirror of
				https://github.com/bufanyun/hotgo.git
				synced 2025-11-04 16:23:43 +08:00 
			
		
		
		
	logic返回有错误代码时,标记为错误日志
This commit is contained in:
		@@ -101,10 +101,14 @@ func responseJson(r *ghttp.Request) {
 | 
			
		||||
 | 
			
		||||
	if err = r.GetError(); err != nil {
 | 
			
		||||
		// 记录到自定义错误日志文件
 | 
			
		||||
		g.Log().Stdout(false).Printf(ctx, "exception:%v", err)
 | 
			
		||||
 | 
			
		||||
		code = gerror.Code(err).Code()
 | 
			
		||||
 | 
			
		||||
		if code == gcode.CodeNil.Code() {
 | 
			
		||||
			g.Log().Stdout(false).Printf(ctx, "exception:%v", err)
 | 
			
		||||
		} else {
 | 
			
		||||
			g.Log().Errorf(ctx, "exception:%v", err)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// 是否输出错误到页面
 | 
			
		||||
		if g.Cfg().MustGet(ctx, "hotgo.debug", true).Bool() {
 | 
			
		||||
			message = gerror.Current(err).Error()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user