=changed path from log
This commit is contained in:
parent
9b8d325761
commit
a9a06fd142
|
@ -2,7 +2,7 @@ package rotater
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path/filepath"
|
||||||
"log"
|
"log"
|
||||||
"amuz.es/src/infra/goutils/logger"
|
"amuz.es/src/infra/goutils/logger"
|
||||||
"github.com/lestrrat-go/file-rotatelogs"
|
"github.com/lestrrat-go/file-rotatelogs"
|
||||||
|
@ -19,11 +19,12 @@ func NewLogWriter(FileName string, logDir string, options ...Option) (logger.Rot
|
||||||
default:
|
default:
|
||||||
logpath := FileName
|
logpath := FileName
|
||||||
if logDir != "" {
|
if logDir != "" {
|
||||||
logpath = path.Join(logDir, FileName)
|
logpath = filepath.Join(logDir, FileName)
|
||||||
}
|
}
|
||||||
|
logpath,_ = filepath.Abs(logpath)
|
||||||
log.Println(" Attention!! log writes to ", logpath)
|
log.Println(" Attention!! log writes to ", logpath)
|
||||||
options=append(options,rotatelogs.WithLinkName(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
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
loggers.Store(logWriter)
|
loggers.Store(logWriter)
|
||||||
|
|
Reference in New Issue