use helper func

This commit is contained in:
Anton Kaliaev 2017-05-13 18:11:06 +02:00 committed by Ethan Frey
parent 41ef8af108
commit f2e452435a
1 changed files with 3 additions and 10 deletions

View File

@ -130,16 +130,9 @@ func startTendermint(dir string, basecoinApp *app.Basecoin) error {
cfg.SetRoot(cfg.RootDir)
config.EnsureRoot(cfg.RootDir)
var tmLogger log.Logger
switch cfg.LogLevel {
case "info":
tmLogger = log.NewFilter(logger, log.AllowInfo())
case "debug":
tmLogger = log.NewFilter(logger, log.AllowDebug())
case "error":
tmLogger = log.NewFilter(logger, log.AllowError())
default:
panic(fmt.Sprintf("Unexpected log level \"%v\", expect either \"info\", \"debug\" or \"error\""))
tmLogger, err := log.NewFilterByLevel(logger, cfg.LogLevel)
if err != nil {
return err
}
// Create & start tendermint node