logging on gen
Juan Batiz-Benet committed
Oct 2, 2014 at 03:04 UTC
7bf7afb7a9cc67c0b91113a735e7210c3df8575f
2 files changed
+6
-3
cmd/ipfs/gen.go
+2
-3
@@ -47,12 +47,11 @@ func makeCommand(cmdDesc command) commanderFunc {
47
48
err = daemon.SendCommand(cmd, confdir)
49
if err != nil {
50
- fmt.Printf("Executing command locally: %s", err)
50
+ log.Info("Executing command locally: %s", err)
51
// Do locally
52
n, err := localNode(confdir, cmdDesc.online)
53
if err != nil {
54
- fmt.Println("Local node creation failed.")
55
- return err
54
+ return fmt.Errorf("Local node creation failed: %v", err)
55
}
56
57
return cmdDesc.cmdFn(n, cmd.Args, cmd.Opts, os.Stdout)
cmd/ipfs/ipfs.go
+4
@@ -9,6 +9,7 @@ import (
9
flag "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/gonuts/flag"
10
commander "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/commander"
11
ma "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
12
+ logging "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/op/go-logging"
13
14
config "github.com/jbenet/go-ipfs/config"
15
core "github.com/jbenet/go-ipfs/core"
@@ -61,6 +62,9 @@ Use "ipfs help <command>" for more information about a command.
62
Flag: *flag.NewFlagSet("ipfs", flag.ExitOnError),
63
}
64
65
+// log is the command logger
66
+var log = logging.MustGetLogger("cmd/ipfs")
67
+
68
func init() {
69
config, err := config.PathRoot()
70
if err != nil {