Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
4c129271a5 | |||
5820e0ded2 | |||
119fee49af | |||
a2a63aebee |
3
go.mod
3
go.mod
@@ -3,8 +3,7 @@ module github.com/ehlxr/log
|
|||||||
go 1.13
|
go 1.13
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/ehlxr/lumberjack v2.0.0+incompatible
|
github.com/ehlxr/lumberjack v0.0.1
|
||||||
github.com/robfig/cron/v3 v3.0.0
|
github.com/robfig/cron/v3 v3.0.0
|
||||||
go.uber.org/zap v1.12.0
|
go.uber.org/zap v1.12.0
|
||||||
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
|
|
||||||
)
|
)
|
||||||
|
2
log.go
2
log.go
@@ -242,7 +242,7 @@ func (lc *logConfig) fileWriteSyncer(fileName string) zapcore.WriteSyncer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Rotating log files daily
|
// Rotating log files daily
|
||||||
runner := cron.New(cron.WithSeconds(), cron.WithLocation(time.UTC))
|
runner := cron.New(cron.WithSeconds(), cron.WithLocation(time.Local))
|
||||||
_, _ = runner.AddFunc("0 0 0 * * ?", func() {
|
_, _ = runner.AddFunc("0 0 0 * * ?", func() {
|
||||||
_ = writer.Rotate(time.Now().AddDate(0, 0, -1))
|
_ = writer.Rotate(time.Now().AddDate(0, 0, -1))
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user