add log_level flag
This commit is contained in:
parent
15aa929f42
commit
1f93e965fb
2
Makefile
2
Makefile
@ -2,7 +2,7 @@ PACKAGES=$(shell go list ./... | grep -v '/vendor/')
|
||||
COMMIT_HASH := $(shell git rev-parse --short HEAD)
|
||||
BUILD_FLAGS = -ldflags "-X github.com/cosmos/cosmos-sdk/version.GitCommit=${COMMIT_HASH}"
|
||||
|
||||
all: check_tools get_vendor_deps build test
|
||||
all: check_tools get_vendor_deps build build_examples test
|
||||
|
||||
########################################
|
||||
### CI
|
||||
|
||||
@ -17,7 +17,7 @@ import (
|
||||
|
||||
// rootCmd is the entry point for this binary
|
||||
var (
|
||||
context = server.NewContext(nil, nil)
|
||||
context = server.NewDefaultContext()
|
||||
rootCmd = &cobra.Command{
|
||||
Use: "gaiad",
|
||||
Short: "Gaia Daemon (server)",
|
||||
|
||||
@ -15,9 +15,9 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/server"
|
||||
)
|
||||
|
||||
// basecoindCmd is the entry point for this binary
|
||||
// rootCmd is the entry point for this binary
|
||||
var (
|
||||
context = server.NewContext(nil, nil)
|
||||
context = server.NewDefaultContext()
|
||||
rootCmd = &cobra.Command{
|
||||
Use: "basecoind",
|
||||
Short: "Basecoin Daemon (server)",
|
||||
|
||||
@ -17,9 +17,9 @@ import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
// democoindCmd is the entry point for this binary
|
||||
// rootCmd is the entry point for this binary
|
||||
var (
|
||||
context = server.NewContext(nil, nil)
|
||||
context = server.NewDefaultContext()
|
||||
rootCmd = &cobra.Command{
|
||||
Use: "democoind",
|
||||
Short: "Democoin Daemon (server)",
|
||||
|
||||
@ -19,6 +19,13 @@ type Context struct {
|
||||
Logger log.Logger
|
||||
}
|
||||
|
||||
func NewDefaultContext() *Context {
|
||||
return NewContext(
|
||||
cfg.DefaultConfig(),
|
||||
log.NewTMLogger(log.NewSyncWriter(os.Stdout)),
|
||||
)
|
||||
}
|
||||
|
||||
func NewContext(config *cfg.Config, logger log.Logger) *Context {
|
||||
return &Context{config, logger}
|
||||
}
|
||||
@ -57,6 +64,8 @@ func AddCommands(
|
||||
appState GenAppState, appCreator AppCreator,
|
||||
context *Context) {
|
||||
|
||||
rootCmd.PersistentFlags().String("log_level", context.Config.LogLevel, "Log level")
|
||||
|
||||
rootCmd.AddCommand(
|
||||
InitCmd(appState, context),
|
||||
StartCmd(appCreator, context),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user