@cryptotaxi247 / kubo / commits / 92e308f32

core/commands2: Added logging

Matt Bell committed Nov 2, 2014 at 23:35 UTC 92e308f32b3cfff4db357e25213a4018671e33ab
1 file changed +5
core/commands2/root.go
+5
@@ -5,8 +5,11 @@ import (
5 "strings"
6
7 cmds "github.com/jbenet/go-ipfs/commands"
8 + u "github.com/jbenet/go-ipfs/util"
9 )
10
11 +var log = u.Logger("core/commands")
12 +
13 type TestOutput struct {
14 Foo string
15 Bar int
@@ -64,6 +67,7 @@ var rootSubcommands = map[string]*cmds.Command{
67 "beep": &cmds.Command{
68 Run: func(res cmds.Response, req cmds.Request) {
69 v := &TestOutput{"hello, world", 1337}
70 + log.Info("beep")
71 res.SetValue(v)
72 },
73 Format: func(res cmds.Response) (string, error) {
@@ -108,4 +112,5 @@ var rootSubcommands = map[string]*cmds.Command{
112
113 func init() {
114 Root.Subcommands = rootSubcommands
115 + u.SetLogLevel("core/commands", "info")
116 }