added logrptate policy
This commit is contained in:
parent
27c1d2ff41
commit
9b8d325761
|
@ -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)
|
||||
|
|
Reference in New Issue