aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/utils/flags.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-02-22 20:10:07 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-02-23 18:16:44 +0800
commitd4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851 (patch)
tree17c93170551d3eeabe2935de1765f157007f0dc2 /cmd/utils/flags.go
parent47af53f9aaf9aa7b12cd976eb150ccf3d64da6fd (diff)
downloadgo-tangerine-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.tar
go-tangerine-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.tar.gz
go-tangerine-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.tar.bz2
go-tangerine-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.tar.lz
go-tangerine-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.tar.xz
go-tangerine-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.tar.zst
go-tangerine-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.zip
all: blidly swap out glog to our log15, logs need rework
Diffstat (limited to 'cmd/utils/flags.go')
-rw-r--r--cmd/utils/flags.go49
1 files changed, 24 insertions, 25 deletions
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index 92eb05e32..55713c15c 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -41,8 +41,7 @@ import (
"github.com/ethereum/go-ethereum/ethstats"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/les"
- "github.com/ethereum/go-ethereum/logger"
- "github.com/ethereum/go-ethereum/logger/glog"
+ "github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/p2p/discover"
@@ -426,7 +425,7 @@ func MakeDataDir(ctx *cli.Context) string {
}
return path
}
- Fatalf("Cannot determine default data directory, please set manually (--datadir)")
+ log.Crit(fmt.Sprintf("Cannot determine default data directory, please set manually (--datadir)"))
return ""
}
@@ -452,16 +451,16 @@ func MakeNodeKey(ctx *cli.Context) *ecdsa.PrivateKey {
)
switch {
case file != "" && hex != "":
- Fatalf("Options %q and %q are mutually exclusive", NodeKeyFileFlag.Name, NodeKeyHexFlag.Name)
+ log.Crit(fmt.Sprintf("Options %q and %q are mutually exclusive", NodeKeyFileFlag.Name, NodeKeyHexFlag.Name))
case file != "":
if key, err = crypto.LoadECDSA(file); err != nil {
- Fatalf("Option %q: %v", NodeKeyFileFlag.Name, err)
+ log.Crit(fmt.Sprintf("Option %q: %v", NodeKeyFileFlag.Name, err))
}
case hex != "":
if key, err = crypto.HexToECDSA(hex); err != nil {
- Fatalf("Option %q: %v", NodeKeyHexFlag.Name, err)
+ log.Crit(fmt.Sprintf("Option %q: %v", NodeKeyHexFlag.Name, err))
}
}
return key
@@ -493,7 +492,7 @@ func MakeBootstrapNodes(ctx *cli.Context) []*discover.Node {
for _, url := range urls {
node, err := discover.ParseNode(url)
if err != nil {
- glog.V(logger.Error).Infof("Bootstrap URL %s: %v\n", url, err)
+ log.Error(fmt.Sprintf("Bootstrap URL %s: %v\n", url, err))
continue
}
bootnodes = append(bootnodes, node)
@@ -513,7 +512,7 @@ func MakeBootstrapNodesV5(ctx *cli.Context) []*discv5.Node {
for _, url := range urls {
node, err := discv5.ParseNode(url)
if err != nil {
- glog.V(logger.Error).Infof("Bootstrap URL %s: %v\n", url, err)
+ log.Error(fmt.Sprintf("Bootstrap URL %s: %v\n", url, err))
continue
}
bootnodes = append(bootnodes, node)
@@ -537,7 +536,7 @@ func MakeDiscoveryV5Address(ctx *cli.Context) string {
func MakeNAT(ctx *cli.Context) nat.Interface {
natif, err := nat.Parse(ctx.GlobalString(NATFlag.Name))
if err != nil {
- Fatalf("Option %s: %v", NATFlag.Name, err)
+ log.Crit(fmt.Sprintf("Option %s: %v", NATFlag.Name, err))
}
return natif
}
@@ -574,11 +573,11 @@ func MakeWSRpcHost(ctx *cli.Context) string {
// for Geth and returns half of the allowance to assign to the database.
func MakeDatabaseHandles() int {
if err := raiseFdLimit(2048); err != nil {
- Fatalf("Failed to raise file descriptor allowance: %v", err)
+ log.Crit(fmt.Sprintf("Failed to raise file descriptor allowance: %v", err))
}
limit, err := getFdLimit()
if err != nil {
- Fatalf("Failed to retrieve file descriptor allowance: %v", err)
+ log.Crit(fmt.Sprintf("Failed to retrieve file descriptor allowance: %v", err))
}
if limit > 2048 { // cap database file descriptors even if more is available
limit = 2048
@@ -610,7 +609,7 @@ func MakeAddress(ks *keystore.KeyStore, account string) (accounts.Account, error
func MakeEtherbase(ks *keystore.KeyStore, ctx *cli.Context) common.Address {
accounts := ks.Accounts()
if !ctx.GlobalIsSet(EtherbaseFlag.Name) && len(accounts) == 0 {
- glog.V(logger.Error).Infoln("WARNING: No etherbase set and no accounts found as default")
+ log.Error(fmt.Sprint("WARNING: No etherbase set and no accounts found as default"))
return common.Address{}
}
etherbase := ctx.GlobalString(EtherbaseFlag.Name)
@@ -620,7 +619,7 @@ func MakeEtherbase(ks *keystore.KeyStore, ctx *cli.Context) common.Address {
// If the specified etherbase is a valid address, return it
account, err := MakeAddress(ks, etherbase)
if err != nil {
- Fatalf("Option %q: %v", EtherbaseFlag.Name, err)
+ log.Crit(fmt.Sprintf("Option %q: %v", EtherbaseFlag.Name, err))
}
return account.Address
}
@@ -642,7 +641,7 @@ func MakePasswordList(ctx *cli.Context) []string {
}
text, err := ioutil.ReadFile(path)
if err != nil {
- Fatalf("Failed to read password file: %v", err)
+ log.Crit(fmt.Sprintf("Failed to read password file: %v", err))
}
lines := strings.Split(string(text), "\n")
// Sanitise DOS line endings.
@@ -701,14 +700,14 @@ func MakeNode(ctx *cli.Context, name, gitCommit string) *node.Node {
if netrestrict := ctx.GlobalString(NetrestrictFlag.Name); netrestrict != "" {
list, err := netutil.ParseNetlist(netrestrict)
if err != nil {
- Fatalf("Option %q: %v", NetrestrictFlag.Name, err)
+ log.Crit(fmt.Sprintf("Option %q: %v", NetrestrictFlag.Name, err))
}
config.NetRestrict = list
}
stack, err := node.New(config)
if err != nil {
- Fatalf("Failed to create the protocol stack: %v", err)
+ log.Crit(fmt.Sprintf("Failed to create the protocol stack: %v", err))
}
return stack
}
@@ -724,7 +723,7 @@ func RegisterEthService(ctx *cli.Context, stack *node.Node, extra []byte) {
}
}
if networks > 1 {
- Fatalf("The %v flags are mutually exclusive", netFlags)
+ log.Crit(fmt.Sprintf("The %v flags are mutually exclusive", netFlags))
}
ks := stack.AccountManager().Backends(keystore.KeyStoreType)[0].(*keystore.KeyStore)
@@ -778,7 +777,7 @@ func RegisterEthService(ctx *cli.Context, stack *node.Node, extra []byte) {
if err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) {
return les.New(ctx, ethConf)
}); err != nil {
- Fatalf("Failed to register the Ethereum light node service: %v", err)
+ log.Crit(fmt.Sprintf("Failed to register the Ethereum light node service: %v", err))
}
} else {
if err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) {
@@ -789,7 +788,7 @@ func RegisterEthService(ctx *cli.Context, stack *node.Node, extra []byte) {
}
return fullNode, err
}); err != nil {
- Fatalf("Failed to register the Ethereum full node service: %v", err)
+ log.Crit(fmt.Sprintf("Failed to register the Ethereum full node service: %v", err))
}
}
}
@@ -797,7 +796,7 @@ func RegisterEthService(ctx *cli.Context, stack *node.Node, extra []byte) {
// RegisterShhService configures Whisper and adds it to the given node.
func RegisterShhService(stack *node.Node) {
if err := stack.Register(func(*node.ServiceContext) (node.Service, error) { return whisper.New(), nil }); err != nil {
- Fatalf("Failed to register the Whisper service: %v", err)
+ log.Crit(fmt.Sprintf("Failed to register the Whisper service: %v", err))
}
}
@@ -814,7 +813,7 @@ func RegisterEthStatsService(stack *node.Node, url string) {
return ethstats.New(url, ethServ, lesServ)
}); err != nil {
- Fatalf("Failed to register the Ethereum Stats service: %v", err)
+ log.Crit(fmt.Sprintf("Failed to register the Ethereum Stats service: %v", err))
}
}
@@ -845,7 +844,7 @@ func MakeChainConfigFromDb(ctx *cli.Context, db ethdb.Database) *params.ChainCon
case core.ChainConfigNotFoundErr:
// No configs found, use empty, will populate below
default:
- Fatalf("Could not make chain configuration: %v", err)
+ log.Crit(fmt.Sprintf("Could not make chain configuration: %v", err))
}
}
// set chain id in case it's zero.
@@ -900,7 +899,7 @@ func MakeChainDatabase(ctx *cli.Context, stack *node.Node) ethdb.Database {
chainDb, err := stack.OpenDatabase(name, cache, handles)
if err != nil {
- Fatalf("Could not open database: %v", err)
+ log.Crit(fmt.Sprintf("Could not open database: %v", err))
}
return chainDb
}
@@ -913,7 +912,7 @@ func MakeChain(ctx *cli.Context, stack *node.Node) (chain *core.BlockChain, chai
if ctx.GlobalBool(TestNetFlag.Name) {
_, err := core.WriteTestNetGenesisBlock(chainDb)
if err != nil {
- glog.Fatalln(err)
+ log.Crit(fmt.Sprint(err))
}
}
@@ -925,7 +924,7 @@ func MakeChain(ctx *cli.Context, stack *node.Node) (chain *core.BlockChain, chai
}
chain, err = core.NewBlockChain(chainDb, chainConfig, pow, new(event.TypeMux), vm.Config{EnablePreimageRecording: ctx.GlobalBool(VMEnableDebugFlag.Name)})
if err != nil {
- Fatalf("Could not start chainmanager: %v", err)
+ log.Crit(fmt.Sprintf("Could not start chainmanager: %v", err))
}
return chain, chainDb
}