上传日志文件备份优化

This commit is contained in:
liwei1dao 2022-08-08 15:56:15 +08:00
parent 280ec994c1
commit e167cce59e
3 changed files with 7 additions and 5 deletions

View File

@ -17,8 +17,10 @@ func newSys(options *Options) (sys *Logger, err error) {
MaxBackups: options.MaxBackups, //最大备份数
LocalTime: true, //使用本地时间
}
if err = hook.openNew(); err != nil {
return
if !options.IsDebug {
if err = hook.openNew(); err != nil {
return
}
}
out := make(writeTree, 0, 2)
out = append(out, AddSync(&hook))

View File

@ -23,7 +23,7 @@ func TestMain(m *testing.M) {
var err error
if sys, err = log.NewSys(
log.SetFileName("log.log"),
log.SetIsDebug(false),
log.SetIsDebug(true),
log.SetEncoder(log.TextEncoder),
); err != nil {
fmt.Println(err)

View File

@ -159,7 +159,7 @@ func (this *SCompGateRoute) ReceiveMsg(ctx context.Context, args *pb.AgentMessag
log.Field{Key: "m", Value: method},
log.Field{Key: "uid", Value: args.UserId},
log.Field{Key: "req", Value: msg},
log.Field{Key: "reply", Value: reply},
log.Field{Key: "reply", Value: reply.String()},
)
} else {
reply.Reply = session.Polls()
@ -170,7 +170,7 @@ func (this *SCompGateRoute) ReceiveMsg(ctx context.Context, args *pb.AgentMessag
log.Field{Key: "m", Value: method},
log.Field{Key: "uid", Value: args.UserId},
log.Field{Key: "req", Value: msg},
log.Field{Key: "reply", Value: reply},
log.Field{Key: "reply", Value: reply.String()},
)
}
}