Fix error log when no logs exist

This commit is contained in:
Daniel 2023-09-12 16:38:54 +02:00
parent f51a1c0492
commit 2d9e07aa79

View file

@ -2,6 +2,7 @@ package base
import ( import (
"context" "context"
"errors"
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
@ -31,7 +32,9 @@ func logCleaner(_ context.Context, _ *modules.Task) error {
filepath.Join(dataroot.Root().Path, logFileDir), filepath.Join(dataroot.Root().Path, logFileDir),
func(path string, info os.FileInfo, err error) error { func(path string, info os.FileInfo, err error) error {
if err != nil { if err != nil {
log.Warningf("core: failed to access %s while deleting old log files: %s", path, err) if !errors.Is(err, os.ErrNotExist) {
log.Warningf("core: failed to access %s while deleting old log files: %s", path, err)
}
return nil return nil
} }