1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-29 01:12:24 +08:00

Add "ipfs log ls" command

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
This commit is contained in:
Hector Sanjuan
2016-05-04 23:33:43 +02:00
parent 57b494a70c
commit fba1448556

View File

@ -3,9 +3,11 @@ package commands
import (
"fmt"
"io"
"strings"
logging "gx/ipfs/QmaDNZ4QMdBdku1YZWBysufYyoQt1negQGNav6PLYarbY8/go-log"
cmds "github.com/ipfs/go-ipfs/commands"
logging "gx/ipfs/QmaDNZ4QMdBdku1YZWBysufYyoQt1negQGNav6PLYarbY8/go-log"
)
// Golang os.Args overrides * and replaces the character argument with
@ -25,6 +27,7 @@ output of a running daemon.
Subcommands: map[string]*cmds.Command{
"level": logLevelCmd,
"ls": logLsCmd,
"tail": logTailCmd,
},
}
@ -70,6 +73,24 @@ output of a running daemon.
Type: MessageOutput{},
}
var logLsCmd = &cmds.Command{
Helptext: cmds.HelpText{
Tagline: "List the logging subsystems.",
ShortDescription: `
'ipfs log ls' is a utility command used to list the logging
subsystems of a running daemon.
`,
},
Run: func(req cmds.Request, res cmds.Response) {
output := strings.Join(logging.GetSubsystems(), "\n")
res.SetOutput(&MessageOutput{output + "\n"})
},
Marshalers: cmds.MarshalerMap{
cmds.Text: MessageTextMarshaler,
},
Type: MessageOutput{},
}
var logTailCmd = &cmds.Command{
Helptext: cmds.HelpText{
Tagline: "Read the logs.",