Browse Source

服务端RPC函数修改日志输出

master
xyiege 5 months ago
parent
commit
41b3382dad
  1. 13
      aufs/core/sendzip.go
  2. 8
      scagent/core/FileRpc.go

13
aufs/core/sendzip.go

@ -12,9 +12,20 @@ import (
"time"
)
// 将文件打包成压缩包
// 远程调用压缩包
func SendZip(w http.ResponseWriter, r *http.Request) {
r.ParseForm()
// 文件
zipfarr := r.Form["sfiles"]
// 服务器ip地址
serip := r.Form["serverip"]
}
// 将文件打包成压缩包
func SendZip00(w http.ResponseWriter, r *http.Request) {
r.ParseForm()
// 选择文件,并生成zip包
// 文件
zipfarr := r.Form["sfiles"]

8
scagent/core/FileRpc.go

@ -9,6 +9,8 @@ import (
"scagent/util"
"strings"
"time"
"go.uber.org/zap"
)
// FileService 提供文件传输服务
@ -54,6 +56,9 @@ func (f *FileService) Upload(chunk FileChunk, reply *bool) error {
// 压缩文件
// 返回压缩包的名称
func (f *FileService) Compress(args *ZipBlock, reply *string) error {
// 启用日志
logger := util.NewProductionLogger()
defer logger.Sync()
// 实际路径
realFilePath := filepath.Join(config.G.FilePath, args.Curpath)
// zip 文件名
@ -64,7 +69,8 @@ func (f *FileService) Compress(args *ZipBlock, reply *string) error {
go func() {
util.CompressToZip(zpFileName, realFilePath, args.SelFile)
taskId <- "arcok"
// fmt.Fprintln(w, "create archive:", err)
// 日志输出
logger.Info("压缩文件", zap.String("filename", zpFileName), zap.String("path", realFilePath))
}()
// ZIP 文件的实际路径
ziprl := path.Join("./sync_zips/", zpFileName)

Loading…
Cancel
Save