1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-21 19:50:56 +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) err = daemon.SendCommand(cmd, confdir)
if err != nil { if err != nil {
fmt.Printf("Executing command locally: %s", err) log.Info("Executing command locally: %s", err)
// Do locally // Do locally
n, err := localNode(confdir, cmdDesc.online) n, err := localNode(confdir, cmdDesc.online)
if err != nil { if err != nil {
fmt.Println("Local node creation failed.") return fmt.Errorf("Local node creation failed: %v", err)
return err
} }
return cmdDesc.cmdFn(n, cmd.Args, cmd.Opts, os.Stdout) 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" 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" 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" 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" config "github.com/jbenet/go-ipfs/config"
core "github.com/jbenet/go-ipfs/core" 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), Flag: *flag.NewFlagSet("ipfs", flag.ExitOnError),
} }
// log is the command logger
var log = logging.MustGetLogger("cmd/ipfs")
func init() { func init() {
config, err := config.PathRoot() config, err := config.PathRoot()
if err != nil { if err != nil {