github.com/gogf/gf@v1.16.9/net/ghttp/ghttp_server_error_logger.go (about) 1 // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. 2 // 3 // This Source Code Form is subject to the terms of the MIT License. 4 // If a copy of the MIT was not distributed with this file, 5 // You can obtain one at https://github.com/gogf/gf. 6 7 package ghttp 8 9 import ( 10 "bytes" 11 "github.com/gogf/gf/os/glog" 12 ) 13 14 // errorLogger is the error logging logger for underlying net/http.Server. 15 type errorLogger struct { 16 logger *glog.Logger 17 } 18 19 // Write implements the io.Writer interface. 20 func (l *errorLogger) Write(p []byte) (n int, err error) { 21 l.logger.Skip(1).Error(string(bytes.TrimRight(p, "\r\n"))) 22 return len(p), nil 23 }