Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
4e29474ab9
@ -92,7 +92,7 @@ func (l *LogFileOut) openExistingOrNew(writeLen int) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//校验是否需要切割日志
|
//校验是否需要切割日志
|
||||||
if info.Size()+int64(writeLen) >= l.max() || time.Since(l.ctime) > l.CupTime {
|
if info.Size()+int64(writeLen) >= l.max() || (!l.ctime.IsZero() && time.Since(l.ctime) > l.CupTime) {
|
||||||
return l.rotate()
|
return l.rotate()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,8 +17,10 @@ func newSys(options *Options) (sys *Logger, err error) {
|
|||||||
MaxBackups: options.MaxBackups, //最大备份数
|
MaxBackups: options.MaxBackups, //最大备份数
|
||||||
LocalTime: true, //使用本地时间
|
LocalTime: true, //使用本地时间
|
||||||
}
|
}
|
||||||
if err = hook.openNew(); err != nil {
|
if !options.IsDebug {
|
||||||
return
|
if err = hook.openNew(); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
out := make(writeTree, 0, 2)
|
out := make(writeTree, 0, 2)
|
||||||
out = append(out, AddSync(&hook))
|
out = append(out, AddSync(&hook))
|
||||||
|
@ -23,7 +23,7 @@ func TestMain(m *testing.M) {
|
|||||||
var err error
|
var err error
|
||||||
if sys, err = log.NewSys(
|
if sys, err = log.NewSys(
|
||||||
log.SetFileName("log.log"),
|
log.SetFileName("log.log"),
|
||||||
log.SetIsDebug(false),
|
log.SetIsDebug(true),
|
||||||
log.SetEncoder(log.TextEncoder),
|
log.SetEncoder(log.TextEncoder),
|
||||||
); err != nil {
|
); err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
|
@ -159,7 +159,7 @@ func (this *SCompGateRoute) ReceiveMsg(ctx context.Context, args *pb.AgentMessag
|
|||||||
log.Field{Key: "m", Value: method},
|
log.Field{Key: "m", Value: method},
|
||||||
log.Field{Key: "uid", Value: args.UserId},
|
log.Field{Key: "uid", Value: args.UserId},
|
||||||
log.Field{Key: "req", Value: msg},
|
log.Field{Key: "req", Value: msg},
|
||||||
log.Field{Key: "reply", Value: reply},
|
log.Field{Key: "reply", Value: reply.String()},
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
reply.Reply = session.Polls()
|
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: "m", Value: method},
|
||||||
log.Field{Key: "uid", Value: args.UserId},
|
log.Field{Key: "uid", Value: args.UserId},
|
||||||
log.Field{Key: "req", Value: msg},
|
log.Field{Key: "req", Value: msg},
|
||||||
log.Field{Key: "reply", Value: reply},
|
log.Field{Key: "reply", Value: reply.String()},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user