diff --git a/Makefile b/Makefile index 2534345740..b5177621aa 100644 --- a/Makefile +++ b/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 diff --git a/cmd/gaiad/main.go b/cmd/gaiad/main.go index d5f2311e46..e44bc73eac 100644 --- a/cmd/gaiad/main.go +++ b/cmd/gaiad/main.go @@ -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)", diff --git a/examples/basecoin/cmd/basecoind/main.go b/examples/basecoin/cmd/basecoind/main.go index 3153330086..34e45bf312 100644 --- a/examples/basecoin/cmd/basecoind/main.go +++ b/examples/basecoin/cmd/basecoind/main.go @@ -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)", diff --git a/examples/democoin/cmd/democoind/main.go b/examples/democoin/cmd/democoind/main.go index 6fc5930678..076eda248b 100644 --- a/examples/democoin/cmd/democoind/main.go +++ b/examples/democoin/cmd/democoind/main.go @@ -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)", diff --git a/server/util.go b/server/util.go index a41eb179e0..95dc4b30d3 100644 --- a/server/util.go +++ b/server/util.go @@ -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),