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:
@@ -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{}
|
||||
|
||||
Reference in New Issue
Block a user