Add "ipfs log ls" command
License: MIT Signed-off-by: Hector Sanjuan <code@hector.link>
Hector Sanjuan committed
May 4, 2016 at 23:33 UTC
fba144855630e5528e29fc398518c93326b9edc3
1 file changed
+22
-1
core/commands/log.go
+22
-1
@@ -3,9 +3,11 @@ package commands
3
import (
4
"fmt"
5
"io"
6
+ "strings"
7
7
- cmds "github.com/ipfs/go-ipfs/commands"
8
logging "gx/ipfs/QmaDNZ4QMdBdku1YZWBysufYyoQt1negQGNav6PLYarbY8/go-log"
9
+
10
+ cmds "github.com/ipfs/go-ipfs/commands"
11
)
12
13
// Golang os.Args overrides * and replaces the character argument with
@@ -25,6 +27,7 @@ output of a running daemon.
27
28
Subcommands: map[string]*cmds.Command{
29
"level": logLevelCmd,
30
+ "ls": logLsCmd,
31
"tail": logTailCmd,
32
},
33
}
@@ -70,6 +73,24 @@ output of a running daemon.
73
Type: MessageOutput{},
74
}
75
76
+var logLsCmd = &cmds.Command{
77
+ Helptext: cmds.HelpText{
78
+ Tagline: "List the logging subsystems.",
79
+ ShortDescription: `
80
+'ipfs log ls' is a utility command used to list the logging
81
+subsystems of a running daemon.
82
+`,
83
+ },
84
+ Run: func(req cmds.Request, res cmds.Response) {
85
+ output := strings.Join(logging.GetSubsystems(), "\n")
86
+ res.SetOutput(&MessageOutput{output + "\n"})
87
+ },
88
+ Marshalers: cmds.MarshalerMap{
89
+ cmds.Text: MessageTextMarshaler,
90
+ },
91
+ Type: MessageOutput{},
92
+}
93
+
94
var logTailCmd = &cmds.Command{
95
Helptext: cmds.HelpText{
96
Tagline: "Read the logs.",