mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-30 18:27:36 +00:00
fix option Verbosity in toml file
This commit is contained in:
parent
b969dc7790
commit
5afb844e0a
4 changed files with 13 additions and 11 deletions
|
|
@ -36,6 +36,7 @@ import (
|
|||
whisper "github.com/ethereum/go-ethereum/whisper/whisperv6"
|
||||
"github.com/naoina/toml"
|
||||
"strings"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
@ -131,7 +132,7 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, XDCConfig) {
|
|||
Node: defaultNodeConfig(),
|
||||
Dashboard: dashboard.DefaultConfig,
|
||||
StakeEnable: true,
|
||||
Verbosity: 0,
|
||||
Verbosity: 3,
|
||||
NAT: "",
|
||||
}
|
||||
// Load config file.
|
||||
|
|
@ -144,7 +145,7 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, XDCConfig) {
|
|||
cfg.StakeEnable = ctx.GlobalBool(utils.StakingEnabledFlag.Name)
|
||||
}
|
||||
if !ctx.GlobalIsSet(debug.VerbosityFlag.Name) {
|
||||
ctx.Set(debug.VerbosityFlag.Name, string(cfg.Verbosity))
|
||||
debug.Glogger.Verbosity(log.Lvl(cfg.Verbosity))
|
||||
}
|
||||
|
||||
if !ctx.GlobalIsSet(utils.NATFlag.Name) && cfg.NAT != "" {
|
||||
|
|
|
|||
|
|
@ -653,6 +653,7 @@ func setListenAddress(ctx *cli.Context, cfg *p2p.Config) {
|
|||
// setNAT creates a port mapper from command line flags.
|
||||
func setNAT(ctx *cli.Context, cfg *p2p.Config) {
|
||||
if ctx.GlobalIsSet(NATFlag.Name) {
|
||||
log.Info("NAT is setted","value",ctx.GlobalString(NATFlag.Name))
|
||||
natif, err := nat.Parse(ctx.GlobalString(NATFlag.Name))
|
||||
if err != nil {
|
||||
Fatalf("Option %s: %v", NATFlag.Name, err)
|
||||
|
|
|
|||
|
|
@ -53,19 +53,19 @@ type HandlerT struct {
|
|||
// Verbosity sets the log verbosity ceiling. The verbosity of individual packages
|
||||
// and source files can be raised using Vmodule.
|
||||
func (*HandlerT) Verbosity(level int) {
|
||||
glogger.Verbosity(log.Lvl(level))
|
||||
Glogger.Verbosity(log.Lvl(level))
|
||||
}
|
||||
|
||||
// Vmodule sets the log verbosity pattern. See package log for details on the
|
||||
// pattern syntax.
|
||||
func (*HandlerT) Vmodule(pattern string) error {
|
||||
return glogger.Vmodule(pattern)
|
||||
return Glogger.Vmodule(pattern)
|
||||
}
|
||||
|
||||
// BacktraceAt sets the log backtrace location. See package log for details on
|
||||
// the pattern syntax.
|
||||
func (*HandlerT) BacktraceAt(location string) error {
|
||||
return glogger.BacktraceAt(location)
|
||||
return Glogger.BacktraceAt(location)
|
||||
}
|
||||
|
||||
// MemStats returns detailed runtime memory statistics.
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ var Flags = []cli.Flag{
|
|||
memprofilerateFlag, blockprofilerateFlag, cpuprofileFlag, traceFlag,
|
||||
}
|
||||
|
||||
var glogger *log.GlogHandler
|
||||
var Glogger *log.GlogHandler
|
||||
|
||||
func init() {
|
||||
usecolor := term.IsTty(os.Stderr.Fd()) && os.Getenv("TERM") != "dumb"
|
||||
|
|
@ -100,7 +100,7 @@ func init() {
|
|||
if usecolor {
|
||||
output = colorable.NewColorableStderr()
|
||||
}
|
||||
glogger = log.NewGlogHandler(log.StreamHandler(output, log.TerminalFormat(usecolor)))
|
||||
Glogger = log.NewGlogHandler(log.StreamHandler(output, log.TerminalFormat(usecolor)))
|
||||
}
|
||||
|
||||
// Setup initializes profiling and logging based on the CLI flags.
|
||||
|
|
@ -108,10 +108,10 @@ func init() {
|
|||
func Setup(ctx *cli.Context) error {
|
||||
// logging
|
||||
log.PrintOrigins(ctx.GlobalBool(debugFlag.Name))
|
||||
glogger.Verbosity(log.Lvl(ctx.GlobalInt(VerbosityFlag.Name)))
|
||||
glogger.Vmodule(ctx.GlobalString(vmoduleFlag.Name))
|
||||
glogger.BacktraceAt(ctx.GlobalString(backtraceAtFlag.Name))
|
||||
log.Root().SetHandler(glogger)
|
||||
Glogger.Verbosity(log.Lvl(ctx.GlobalInt(VerbosityFlag.Name)))
|
||||
Glogger.Vmodule(ctx.GlobalString(vmoduleFlag.Name))
|
||||
Glogger.BacktraceAt(ctx.GlobalString(backtraceAtFlag.Name))
|
||||
log.Root().SetHandler(Glogger)
|
||||
|
||||
// profiling, tracing
|
||||
runtime.MemProfileRate = ctx.GlobalInt(memprofilerateFlag.Name)
|
||||
|
|
|
|||
Loading…
Reference in a new issue