cmd: add log command

Add a log command to the common api which allows for listing all
initialized golog subsystems, and setting their log level during
runtime.

Command description also adds golog environment variable documentation.
This commit is contained in:
Travis Person
2020-02-15 06:04:55 +00:00
parent 6bf87e28e9
commit d6cf76a91a
5 changed files with 126 additions and 0 deletions
+10
View File
@@ -3,6 +3,8 @@ package impl
import (
"context"
logging "github.com/ipfs/go-log/v2"
"github.com/gbrlsnchs/jwt/v3"
"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/network"
@@ -92,4 +94,12 @@ func (a *CommonAPI) Version(context.Context) (api.Version, error) {
}, nil
}
func (a *CommonAPI) LogList(context.Context) ([]string, error) {
return logging.GetSubsystems(), nil
}
func (a *CommonAPI) LogSetLevel(ctx context.Context, subsystem, level string) error {
return logging.SetLogLevel(subsystem, level)
}
var _ api.Common = &CommonAPI{}