mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-01 02:23:18 +08:00
Add "ipfs log ls" command
License: MIT Signed-off-by: Hector Sanjuan <code@hector.link>
This commit is contained in:
@ -3,9 +3,11 @@ package commands
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
logging "gx/ipfs/QmaDNZ4QMdBdku1YZWBysufYyoQt1negQGNav6PLYarbY8/go-log"
|
||||||
|
|
||||||
cmds "github.com/ipfs/go-ipfs/commands"
|
cmds "github.com/ipfs/go-ipfs/commands"
|
||||||
logging "gx/ipfs/QmaDNZ4QMdBdku1YZWBysufYyoQt1negQGNav6PLYarbY8/go-log"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Golang os.Args overrides * and replaces the character argument with
|
// Golang os.Args overrides * and replaces the character argument with
|
||||||
@ -25,6 +27,7 @@ output of a running daemon.
|
|||||||
|
|
||||||
Subcommands: map[string]*cmds.Command{
|
Subcommands: map[string]*cmds.Command{
|
||||||
"level": logLevelCmd,
|
"level": logLevelCmd,
|
||||||
|
"ls": logLsCmd,
|
||||||
"tail": logTailCmd,
|
"tail": logTailCmd,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -70,6 +73,24 @@ output of a running daemon.
|
|||||||
Type: MessageOutput{},
|
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{
|
var logTailCmd = &cmds.Command{
|
||||||
Helptext: cmds.HelpText{
|
Helptext: cmds.HelpText{
|
||||||
Tagline: "Read the logs.",
|
Tagline: "Read the logs.",
|
||||||
|
Reference in New Issue
Block a user