1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-20 10:42:11 +08:00

logging on gen

This commit is contained in:
Juan Batiz-Benet
2014-10-02 03:04:42 -07:00
parent e91b2b8aec
commit 7bf7afb7a9
2 changed files with 6 additions and 3 deletions

View File

@ -47,12 +47,11 @@ func makeCommand(cmdDesc command) commanderFunc {
err = daemon.SendCommand(cmd, confdir)
if err != nil {
fmt.Printf("Executing command locally: %s", err)
log.Info("Executing command locally: %s", err)
// Do locally
n, err := localNode(confdir, cmdDesc.online)
if err != nil {
fmt.Println("Local node creation failed.")
return err
return fmt.Errorf("Local node creation failed: %v", err)
}
return cmdDesc.cmdFn(n, cmd.Args, cmd.Opts, os.Stdout)

View File

@ -9,6 +9,7 @@ import (
flag "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/gonuts/flag"
commander "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/commander"
ma "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
logging "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/op/go-logging"
config "github.com/jbenet/go-ipfs/config"
core "github.com/jbenet/go-ipfs/core"
@ -61,6 +62,9 @@ Use "ipfs help <command>" for more information about a command.
Flag: *flag.NewFlagSet("ipfs", flag.ExitOnError),
}
// log is the command logger
var log = logging.MustGetLogger("cmd/ipfs")
func init() {
config, err := config.PathRoot()
if err != nil {