Skip to content

Commit

Permalink
parse log level using tmlibs/cli/flags package (Fixes #97)
Browse files Browse the repository at this point in the history
```
$ basecoin start
loading existing db
I[06-02|06:18:29.290] Done setting Account via SetOption           module=app result=Success
I[06-02|06:18:29.290] Starting Basecoin with Tendermint            module=main chain_id=test_chain_id
ERROR: Expected either "info", "debug", "error" or "none" level, given state:info,*:error
```
  • Loading branch information
melekes committed Jun 2, 2017
1 parent 9a9a3a7 commit 20ce43e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 27 deletions.
7 changes: 2 additions & 5 deletions cmd/commands/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"github.com/tendermint/abci/server"
eyes "github.com/tendermint/merkleeyes/client"
"github.com/tendermint/tmlibs/cli"
cliflags "github.com/tendermint/tmlibs/cli/flags"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"

"github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/node"
Expand Down Expand Up @@ -139,13 +139,10 @@ func startTendermint(dir string, basecoinApp *app.Basecoin) error {
return err
}

// TODO: parse the log level from the config properly (multi modules)
// but some tm code must be refactored for better usability
lvl, err := log.AllowLevel(cfg.LogLevel)
tmLogger, err := cliflags.ParseLogLevel(cfg.LogLevel, logger, config.DefaultConfig().LogLevel)
if err != nil {
return err
}
tmLogger := log.NewFilter(logger, lvl)

// Create & start tendermint node
privValidator := types.LoadOrGenPrivValidator(cfg.PrivValidatorFile(), tmLogger)
Expand Down
42 changes: 20 additions & 22 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import:
- rpc/lib/types
- types
- package: github.com/tendermint/tmlibs
version: develop
subpackages:
- cli
- common
Expand Down

0 comments on commit 20ce43e

Please sign in to comment.