Fix log filename issue on Windows
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
netHttp "net/http"
|
netHttp "net/http"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
// _ "net/http/pprof" // Register pprof
|
// _ "net/http/pprof" // Register pprof
|
||||||
@@ -30,7 +31,9 @@ func MainApp(configPath string) {
|
|||||||
utils.EnsureDirExists("data/info")
|
utils.EnsureDirExists("data/info")
|
||||||
utils.EnsureDirExists("dump") // "zurgtorrent" files
|
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)
|
log := logutil.NewLogger(logPath)
|
||||||
|
|
||||||
zurglog := log.Named("zurg") // logger for this main function
|
zurglog := log.Named("zurg") // logger for this main function
|
||||||
|
|||||||
Reference in New Issue
Block a user