diff options
author | obscuren <geffobscura@gmail.com> | 2015-04-07 20:57:04 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-04-07 20:57:04 +0800 |
commit | 688d118c7e0d439691e84fc6e068ab3e19da5185 (patch) | |
tree | 6891a60950e0c2956c9f2d4fed6fceb67430775c /cmd | |
parent | 01b2c90179ff82e4610745aea0e3e3ca53756305 (diff) | |
download | dexon-688d118c7e0d439691e84fc6e068ab3e19da5185.tar dexon-688d118c7e0d439691e84fc6e068ab3e19da5185.tar.gz dexon-688d118c7e0d439691e84fc6e068ab3e19da5185.tar.bz2 dexon-688d118c7e0d439691e84fc6e068ab3e19da5185.tar.lz dexon-688d118c7e0d439691e84fc6e068ab3e19da5185.tar.xz dexon-688d118c7e0d439691e84fc6e068ab3e19da5185.tar.zst dexon-688d118c7e0d439691e84fc6e068ab3e19da5185.zip |
Updated logging
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/utils/cmd.go | 8 | ||||
-rw-r--r-- | cmd/utils/flags.go | 7 |
2 files changed, 11 insertions, 4 deletions
diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go index feea29d64..a6140d233 100644 --- a/cmd/utils/cmd.go +++ b/cmd/utils/cmd.go @@ -33,10 +33,10 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/rlp" ) -var clilogger = logger.NewLogger("CLI") var interruptCallbacks = []func(os.Signal){} // Register interrupt handlers callbacks @@ -50,7 +50,7 @@ func HandleInterrupt() { go func() { signal.Notify(c, os.Interrupt) for sig := range c { - clilogger.Errorf("Shutting down (%v) ... \n", sig) + glog.V(logger.Error).Infof("Shutting down (%v) ... \n", sig) RunInterruptCallbacks(sig) } }() @@ -113,7 +113,7 @@ func Fatalf(format string, args ...interface{}) { } func StartEthereum(ethereum *eth.Ethereum) { - clilogger.Infoln("Starting ", ethereum.Name()) + glog.V(logger.Info).Infoln("Starting ", ethereum.Name()) if err := ethereum.Start(); err != nil { exit(err) } @@ -124,7 +124,7 @@ func StartEthereum(ethereum *eth.Ethereum) { } func StartEthereumForTest(ethereum *eth.Ethereum) { - clilogger.Infoln("Starting ", ethereum.Name()) + glog.V(logger.Info).Infoln("Starting ", ethereum.Name()) ethereum.StartForTest() RegisterInterrupt(func(sig os.Signal) { ethereum.Stop() diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 0609bcf75..51844a68e 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -194,6 +194,11 @@ var ( Name: "logtostderr", Usage: "Logs are written to standard error instead of to files.", } + LogVModuleFlag = cli.GenericFlag{ + Name: "vmodule", + Usage: "The syntax of the argument is a comma-separated list of pattern=N, where pattern is a literal file name (minus the \".go\" suffix) or \"glob\" pattern and N is a V level.", + Value: glog.GetVModule(), + } ) func GetNAT(ctx *cli.Context) nat.Interface { @@ -227,6 +232,8 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config { glog.SetV(ctx.GlobalInt(LogLevelFlag.Name)) // Set the log type glog.SetToStderr(ctx.GlobalBool(LogToStdErrFlag.Name)) + // Set the log dir + glog.SetLogDir(ctx.GlobalString(LogFileFlag.Name)) return ð.Config{ Name: common.MakeName(clientID, version), |