mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2026-01-04 06:16:36 +08:00
实现节点运行日志上传
This commit is contained in:
@@ -6,9 +6,9 @@ import (
|
||||
"compress/gzip"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
|
||||
"github.com/TeaOSLab/EdgeNode/internal/caches"
|
||||
"github.com/TeaOSLab/EdgeNode/internal/logs"
|
||||
"github.com/TeaOSLab/EdgeNode/internal/utils"
|
||||
"github.com/iwind/TeaGo/lists"
|
||||
"github.com/iwind/TeaGo/logs"
|
||||
"net"
|
||||
"net/http"
|
||||
"strings"
|
||||
@@ -115,7 +115,7 @@ func (this *HTTPWriter) Write(data []byte) (n int, err error) {
|
||||
if err != nil {
|
||||
_ = this.cacheWriter.Discard()
|
||||
this.cacheWriter = nil
|
||||
logs.Println("write cache failed: " + err.Error())
|
||||
logs.Error("REQUEST_WRITER", "write cache failed: "+err.Error())
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -127,7 +127,7 @@ func (this *HTTPWriter) Write(data []byte) (n int, err error) {
|
||||
if this.gzipBodyWriter != nil {
|
||||
_, err := this.gzipBodyWriter.Write(data)
|
||||
if err != nil {
|
||||
logs.Error(err)
|
||||
logs.Error("REQUEST_WRITER", err.Error())
|
||||
}
|
||||
} else {
|
||||
this.body = append(this.body, data...)
|
||||
@@ -281,7 +281,7 @@ func (this *HTTPWriter) prepareGzip(size int64) {
|
||||
var err error = nil
|
||||
this.gzipWriter, err = gzip.NewWriterLevel(this.writer, int(this.gzipConfig.Level))
|
||||
if err != nil {
|
||||
logs.Error(err)
|
||||
logs.Error("REQUEST_WRITER", err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
@@ -290,7 +290,7 @@ func (this *HTTPWriter) prepareGzip(size int64) {
|
||||
this.gzipBodyBuffer = bytes.NewBuffer([]byte{})
|
||||
this.gzipBodyWriter, err = gzip.NewWriterLevel(this.gzipBodyBuffer, int(this.gzipConfig.Level))
|
||||
if err != nil {
|
||||
logs.Error(err)
|
||||
logs.Error("REQUEST_WRITER", err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -357,7 +357,7 @@ func (this *HTTPWriter) prepareCache(size int64) {
|
||||
expiredAt := utils.UnixTime() + life
|
||||
cacheWriter, err := storage.Open(this.req.cacheKey, expiredAt)
|
||||
if err != nil {
|
||||
logs.Println("write cache failed: " + err.Error())
|
||||
logs.Error("REQUEST_WRITER", "write cache failed: "+err.Error())
|
||||
return
|
||||
}
|
||||
this.cacheWriter = cacheWriter
|
||||
@@ -369,7 +369,7 @@ func (this *HTTPWriter) prepareCache(size int64) {
|
||||
headerData := this.HeaderData()
|
||||
_, err = cacheWriter.Write(headerData)
|
||||
if err != nil {
|
||||
logs.Println("write cache failed: " + err.Error())
|
||||
logs.Error("REQUEST_WRITER", "write cache failed: "+err.Error())
|
||||
_ = this.cacheWriter.Discard()
|
||||
this.cacheWriter = nil
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user