infra
/
goutils
Archived
1
0
Fork 0

added logrptate policy

This commit is contained in:
Sangbum Kim 2018-06-12 21:54:31 +09:00
parent 27c1d2ff41
commit 9b8d325761
1 changed files with 3 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import (
"path"
"log"
"amuz.es/src/infra/goutils/logger"
"github.com/lestrrat-go/file-rotatelogs"
)
var loggers RotateSyncerSet
@ -21,7 +22,8 @@ func NewLogWriter(FileName string, logDir string, options ...Option) (logger.Rot
logpath = path.Join(logDir, FileName)
}
log.Println(" Attention!! log writes to ", logpath)
if logWriter, err := NewRotater(logpath, options...); err != nil {
options=append(options,rotatelogs.WithLinkName(logpath))
if logWriter, err := NewRotater(logpath+".%Y%M%D", options...); err != nil {
return nil, err
} else {
loggers.Store(logWriter)