]> Sergey Matveev's repositories - btrtrc.git/commitdiff
fs/cmd/torrentfs: Add main logger
authorMatt Joiner <anacrolix@gmail.com>
Wed, 16 Aug 2023 06:37:28 +0000 (16:37 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Wed, 16 Aug 2023 06:37:28 +0000 (16:37 +1000)
fs/cmd/torrentfs/main.go

index bee151cba1ef1a1f30eb4dd35f8ad99b3ef8b38b..3ebdc281d6cb41bd8296c309665298f24a68ea25 100644 (file)
@@ -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)