From b0d05d27d40ec7f994460afb4cd5a716c33d670a Mon Sep 17 00:00:00 2001 From: Ben Adrian Sarmiento Date: Sun, 2 Jun 2024 11:50:59 +0200 Subject: [PATCH] Fix log filename issue on Windows --- internal/app.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/app.go b/internal/app.go index 6c994ec..5a652dc 100644 --- a/internal/app.go +++ b/internal/app.go @@ -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