Proper log rotation, filename compatibility with windows

This commit is contained in:
Ben Adrian Sarmiento
2024-07-06 12:44:25 +02:00
parent b501b800dd
commit 467f51bdec
6 changed files with 67 additions and 15 deletions

View File

@@ -5,7 +5,6 @@ import (
"fmt"
"os"
"strings"
"time"
"github.com/debridmediamanager/zurg/internal/clear"
"github.com/debridmediamanager/zurg/internal/version"
@@ -23,10 +22,7 @@ func NetworkTest(testURL string) {
utils.EnsureDirExists("logs")
utils.EnsureDirExists("data")
dateStr := time.Now().Format(time.DateOnly)
timeStr := strings.ReplaceAll(time.Now().Format(time.TimeOnly), ":", "-")
logPath := fmt.Sprintf("logs/network-test-%s-%s.log", dateStr, timeStr)
log := logutil.NewLogger(logPath)
log := logutil.NewLogger("logs/network-test.log")
proxyURL := os.Getenv("PROXY")
if proxyURL != "" {