提交 5c0403c6 作者: Henry

eventlog: buffer writes before pushing them to lumberjack - same effect, no…

eventlog: buffer writes before pushing them to lumberjack - same effect, no upstream changes. Thx @natefinch!
上级 eacaa2d7
package eventlog package eventlog
import ( import (
"bufio"
"io" "io"
"os" "os"
...@@ -53,12 +54,12 @@ func Output(w io.Writer) Option { ...@@ -53,12 +54,12 @@ func Output(w io.Writer) Option {
func OutputRotatingLogFile(config LogRotatorConfig) Option { func OutputRotatingLogFile(config LogRotatorConfig) Option {
return func() { return func() {
logrus.SetOutput( logrus.SetOutput(
&lumberjack.Logger{ bufio.NewWriter(&lumberjack.Logger{
Filename: config.Filename, Filename: config.Filename,
MaxSize: int(config.MaxSizeMB), MaxSize: int(config.MaxSizeMB),
MaxBackups: int(config.MaxBackups), MaxBackups: int(config.MaxBackups),
MaxAge: int(config.MaxAgeDays), MaxAge: int(config.MaxAgeDays),
}) }))
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论