mirror of
https://github.com/caddyserver/caddy.git
synced 2024-11-29 20:24:11 +08:00
26 lines
395 B
Go
26 lines
395 B
Go
|
package middleware
|
||
|
|
||
|
import (
|
||
|
"io"
|
||
|
|
||
|
"gopkg.in/natefinch/lumberjack.v2"
|
||
|
)
|
||
|
|
||
|
type LogRoller struct {
|
||
|
Filename string
|
||
|
MaxSize int
|
||
|
MaxAge int
|
||
|
MaxBackups int
|
||
|
LocalTime bool
|
||
|
}
|
||
|
|
||
|
func (l LogRoller) GetLogWriter() io.Writer {
|
||
|
return &lumberjack.Logger{
|
||
|
Filename: l.Filename,
|
||
|
MaxSize: l.MaxSize,
|
||
|
MaxAge: l.MaxAge,
|
||
|
MaxBackups: l.MaxBackups,
|
||
|
LocalTime: l.LocalTime,
|
||
|
}
|
||
|
}
|