Skip to content

Commit

Permalink
main: Log to walletd.log by default
Browse files Browse the repository at this point in the history
  • Loading branch information
lukechampine committed Dec 11, 2023
1 parent 0bba38c commit f477395
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cmd/walletd/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ package main
import (
"context"
"errors"
"io"
"log"
"net"
"os"
"path/filepath"
"strconv"
"time"
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit f477395

Please sign in to comment.