infra
/
goutils
Archived
1
0
Fork 0

=changed path from log

This commit is contained in:
Sangbum Kim 2018-06-12 22:50:41 +09:00
parent 9b8d325761
commit a9a06fd142
1 changed files with 4 additions and 3 deletions

View File

@ -2,7 +2,7 @@ package rotater
import (
"os"
"path"
"path/filepath"
"log"
"amuz.es/src/infra/goutils/logger"
"github.com/lestrrat-go/file-rotatelogs"
@ -19,11 +19,12 @@ func NewLogWriter(FileName string, logDir string, options ...Option) (logger.Rot
default:
logpath := FileName
if logDir != "" {
logpath = path.Join(logDir, FileName)
logpath = filepath.Join(logDir, FileName)
}
logpath,_ = filepath.Abs(logpath)
log.Println(" Attention!! log writes to ", logpath)
options=append(options,rotatelogs.WithLinkName(logpath))
if logWriter, err := NewRotater(logpath+".%Y%M%D", options...); err != nil {
if logWriter, err := NewRotater(logpath+".%Y%m%d", options...); err != nil {
return nil, err
} else {
loggers.Store(logWriter)