Fix log filename issue on Windows

This commit is contained in:
Ben Adrian Sarmiento
2024-06-02 11:50:59 +02:00
parent eab892cf9b
commit b0d05d27d4

View File

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