From fba144855630e5528e29fc398518c93326b9edc3 Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Wed, 4 May 2016 23:33:43 +0200 Subject: [PATCH] Add "ipfs log ls" command License: MIT Signed-off-by: Hector Sanjuan --- core/commands/log.go | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/core/commands/log.go b/core/commands/log.go index 89e54db5a..efeafc6d2 100644 --- a/core/commands/log.go +++ b/core/commands/log.go @@ -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.",