mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 12:46:46 +00:00
Other: Fix MaxLogs off-by-one limit and bump limit to 10
This commit is contained in:
@ -43,7 +43,7 @@ const (
|
|||||||
MaxLogSize = 5 * 1024 * 1024
|
MaxLogSize = 5 * 1024 * 1024
|
||||||
|
|
||||||
// MaxLogs defines how many log files should be kept.
|
// MaxLogs defines how many log files should be kept.
|
||||||
MaxLogs = 3
|
MaxLogs = 10
|
||||||
)
|
)
|
||||||
|
|
||||||
type coloredStdOutHook struct {
|
type coloredStdOutHook struct {
|
||||||
@ -92,8 +92,7 @@ func Init(logsPath, level string) error {
|
|||||||
logrus.AddHook(newColoredStdOutHook())
|
logrus.AddHook(newColoredStdOutHook())
|
||||||
|
|
||||||
rotator, err := NewRotator(MaxLogSize, func() (io.WriteCloser, error) {
|
rotator, err := NewRotator(MaxLogSize, func() (io.WriteCloser, error) {
|
||||||
// Leaving MaxLogs-1 since new log file will be opened right away.
|
if err := clearLogs(logsPath, MaxLogs, MaxLogs); err != nil {
|
||||||
if err := clearLogs(logsPath, MaxLogs-1, MaxLogs); err != nil {
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user