From 5dd20ff99b0d7a4836003adc91c84e5645fa4d99 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Wed, 16 Aug 2023 16:37:28 +1000 Subject: [PATCH] fs/cmd/torrentfs: Add main logger --- fs/cmd/torrentfs/main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/cmd/torrentfs/main.go b/fs/cmd/torrentfs/main.go index bee151cb..3ebdc281 100644 --- a/fs/cmd/torrentfs/main.go +++ b/fs/cmd/torrentfs/main.go @@ -25,6 +25,8 @@ import ( "github.com/anacrolix/torrent/util/dirwatch" ) +var logger = log.Default.WithNames("main") + var args = struct { MetainfoDir string `help:"torrent files in this location describe the contents of the mounted filesystem"` DownloadDir string `help:"location to save torrent data"` @@ -71,7 +73,7 @@ func main() { defer envpprof.Stop() err := mainErr() if err != nil { - log.Printf("error in main: %v", err) + logger.Levelf(log.Error, "error in main: %v", err) os.Exit(1) } } @@ -143,9 +145,11 @@ func mainErr() error { }() } + logger.Levelf(log.Debug, "serving fuse fs") if err := fusefs.Serve(conn, fs); err != nil { return fmt.Errorf("serving fuse fs: %w", err) } + logger.Levelf(log.Debug, "fuse fs completed successfully. waiting for conn ready") <-conn.Ready if err := conn.MountError; err != nil { return fmt.Errorf("mount error: %w", err) -- 2.44.0