From e536281cc83b4607680fb702788b15886fcd0430 Mon Sep 17 00:00:00 2001 From: Chris Marslender Date: Mon, 18 Dec 2023 13:51:02 -0600 Subject: [PATCH] Log to CHIA_ROOT/log --- internal/utils/log.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/utils/log.go b/internal/utils/log.go index 65fa069..4f1c5d1 100644 --- a/internal/utils/log.go +++ b/internal/utils/log.go @@ -2,13 +2,20 @@ package utils import ( "os" + "path/filepath" + "github.com/chia-network/go-chia-libs/pkg/config" log "github.com/sirupsen/logrus" ) // LogToFile logs a message to a given file func LogToFile(filename, message string) error { - file, err := os.OpenFile(filename, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) + rootPath, err := config.GetChiaRootPath() + if err != nil { + return err + } + path := filepath.Join(rootPath, "log", filename) + file, err := os.OpenFile(path, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) if err != nil { return err }