From f477395821e50f00f5cda02e89bc785977e28324 Mon Sep 17 00:00:00 2001 From: lukechampine Date: Mon, 11 Dec 2023 09:17:23 -0500 Subject: [PATCH] main: Log to walletd.log by default --- cmd/walletd/node.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd/walletd/node.go b/cmd/walletd/node.go index 4d7e232..d40c8a4 100644 --- a/cmd/walletd/node.go +++ b/cmd/walletd/node.go @@ -3,8 +3,10 @@ package main import ( "context" "errors" + "io" "log" "net" + "os" "path/filepath" "strconv" "time" @@ -226,7 +228,12 @@ func newNode(addr, dir string, chainNetwork string, useUPNP bool) (*node, error) UniqueID: gateway.GenerateUniqueID(), NetAddress: syncerAddr, } - s := syncer.New(l, cm, ps, header, syncer.WithLogger(log.Default())) + logFile, err := os.OpenFile(filepath.Join(dir, "walletd.log"), os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0600) + if err != nil { + log.Fatal(err) + } + logger := log.New(io.MultiWriter(os.Stderr, logFile), "", log.LstdFlags) + s := syncer.New(l, cm, ps, header, syncer.WithLogger(logger)) wm, err := walletutil.NewJSONWalletManager(dir, cm) if err != nil {