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 (
netHttp "net/http"
"os"
"os/exec"
"strings"
"time"
// _ "net/http/pprof" // Register pprof
@@ -31,10 +30,7 @@ func MainApp(configPath string) {
utils.EnsureDirExists("data/info")
utils.EnsureDirExists("dump") // "zurgtorrent" files
dateStr := time.Now().Format(time.DateOnly)
timeStr := strings.ReplaceAll(time.Now().Format(time.TimeOnly), ":", "-")
logPath := fmt.Sprintf("logs/zurg-%s-%s.log", dateStr, timeStr)
log := logutil.NewLogger(logPath)
log := logutil.NewLogger("logs/zurg.log")
zurglog := log.Named("zurg") // logger for this main function