Add logs route, add rar handler

This commit is contained in:
Ben Sarmiento
2023-12-06 19:18:04 +01:00
parent 2a0b0fa9cd
commit 2aacff1125
19 changed files with 151 additions and 44 deletions

View File

@@ -4,6 +4,7 @@ import (
"fmt"
netHttp "net/http"
"os"
"time"
// _ "net/http/pprof" // Register pprof
@@ -20,7 +21,9 @@ import (
)
func MainApp(configPath string) {
log := logutil.NewLogger()
utils.EnsureDirExists("logs") // Ensure the logs directory exists
logPath := fmt.Sprintf("logs/zurg-%s.log", time.Now().Format(time.DateOnly))
log := logutil.NewLogger(logPath)
zurglog := log.Named("zurg")
zurglog.Debugf("PID: %d", os.Getpid())
@@ -42,8 +45,7 @@ func MainApp(configPath string) {
}
defer p.Release()
utils.EnsureDirExists("data")
utils.EnsureDirExists("data") // Ensure the data directory exists
torrentMgr := torrent.NewTorrentManager(config, rd, p, log.Named("manager"))
downloadClient := http.NewHTTPClient(config.GetToken(), config.GetRetriesUntilFailed(), 0, config, log.Named("dlclient"))