chantools icon indicating copy to clipboard operation
chantools copied to clipboard

allow disabling log file output and creation of the `results` directory

Open ZZiigguurraatt opened this issue 10 months ago • 1 comments

Upon startup, chantools tries to create a directory $PWD/results, and then writes a file chantools.log inside of it. If $PWD is currently read only, we get an error:

tester@fc610f97347b:/$ chantools help
panic: failed to create log directory: mkdir ./results/: permission denied

goroutine 1 [running]:
main.setupLogging()
	github.com/lightninglabs/chantools/cmd/chantools/root.go:315 +0x185
main.init.func1(0xc0001d1d00?, {0x1a16674?, 0x4?, 0x1a16678?})
	github.com/lightninglabs/chantools/cmd/chantools/root.go:78 +0xd5
github.com/spf13/cobra.(*Command).execute(0xc000224b08, {0x2bd8560, 0x0, 0x0})
	github.com/spf13/[email protected]/command.go:836 +0x59b
github.com/spf13/cobra.(*Command).ExecuteC(0x2b5cf00)
	github.com/spf13/[email protected]/command.go:960 +0x389
github.com/spf13/cobra.(*Command).Execute(...)
	github.com/spf13/[email protected]/command.go:897
main.main()
	github.com/lightninglabs/chantools/cmd/chantools/root.go:139 +0x55e
tester@fc610f97347b:/$ 

We need a command line option to disable log file output and creation of the results directory so that chantools can be used on read only filesystems on stateless devices.

ZZiigguurraatt avatar Jan 12 '25 01:01 ZZiigguurraatt