aboutsummaryrefslogtreecommitdiffstats
path: root/eth
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-23 04:43:36 +0800
committerobscuren <geffobscura@gmail.com>2015-03-23 04:43:36 +0800
commit8b1b9fc99d63a19c216edebc07096718e835937d (patch)
tree8a04499cb63dd8d91fd136f65c29605844c5bae8 /eth
parent8ed4f226d1dbecc9625a2f142e22926569198b73 (diff)
parent0edb33566fbe20863c884e553e214ed9b78b0f23 (diff)
downloaddexon-8b1b9fc99d63a19c216edebc07096718e835937d.tar
dexon-8b1b9fc99d63a19c216edebc07096718e835937d.tar.gz
dexon-8b1b9fc99d63a19c216edebc07096718e835937d.tar.bz2
dexon-8b1b9fc99d63a19c216edebc07096718e835937d.tar.lz
dexon-8b1b9fc99d63a19c216edebc07096718e835937d.tar.xz
dexon-8b1b9fc99d63a19c216edebc07096718e835937d.tar.zst
dexon-8b1b9fc99d63a19c216edebc07096718e835937d.zip
Merge branch 'jsonlog' of https://github.com/ethersphere/go-ethereum into ethersphere-jsonlog
Conflicts: eth/backend.go
Diffstat (limited to 'eth')
-rw-r--r--eth/backend.go38
1 files changed, 21 insertions, 17 deletions
diff --git a/eth/backend.go b/eth/backend.go
index c312f9b4b..06c3cbd17 100644
--- a/eth/backend.go
+++ b/eth/backend.go
@@ -42,11 +42,11 @@ type Config struct {
ProtocolVersion int
NetworkId int
- DataDir string
- LogFile string
- LogLevel int
- LogFormat string
- VmDebug bool
+ DataDir string
+ LogFile string
+ LogLevel int
+ LogJSON string
+ VmDebug bool
MaxPeers int
Port string
@@ -136,7 +136,7 @@ type Ethereum struct {
blockSub event.Subscription
miner *miner.Miner
- logger logger.LogSystem
+ // logger logger.LogSystem
Mining bool
DataDir string
@@ -147,7 +147,10 @@ type Ethereum struct {
func New(config *Config) (*Ethereum, error) {
// Boostrap database
- servlogsystem := logger.New(config.DataDir, config.LogFile, config.LogLevel, config.LogFormat)
+ logger.New(config.DataDir, config.LogFile, config.LogLevel)
+ if len(config.LogJSON) > 0 {
+ logger.NewJSONsystem(config.DataDir, config.LogJSON)
+ }
newdb := config.NewDB
if newdb == nil {
@@ -174,12 +177,12 @@ func New(config *Config) (*Ethereum, error) {
servlogger.Infof("Protocol Version: %v, Network Id: %v", config.ProtocolVersion, config.NetworkId)
eth := &Ethereum{
- shutdownChan: make(chan bool),
- blockDb: blockDb,
- stateDb: stateDb,
- extraDb: extraDb,
- eventMux: &event.TypeMux{},
- logger: servlogsystem,
+ shutdownChan: make(chan bool),
+ blockDb: blockDb,
+ stateDb: stateDb,
+ extraDb: extraDb,
+ eventMux: &event.TypeMux{},
+ // logger: servlogsystem,
accountManager: config.AccountManager,
DataDir: config.DataDir,
version: config.Name, // TODO should separate from Name
@@ -300,10 +303,11 @@ func (s *Ethereum) StartMining() error {
return nil
}
-func (s *Ethereum) StopMining() { s.miner.Stop() }
-func (s *Ethereum) IsMining() bool { return s.miner.Mining() }
-func (s *Ethereum) Miner() *miner.Miner { return s.miner }
-func (s *Ethereum) Logger() logger.LogSystem { return s.logger }
+func (s *Ethereum) StopMining() { s.miner.Stop() }
+func (s *Ethereum) IsMining() bool { return s.miner.Mining() }
+func (s *Ethereum) Miner() *miner.Miner { return s.miner }
+
+// func (s *Ethereum) Logger() logger.LogSystem { return s.logger }
func (s *Ethereum) Name() string { return s.net.Name }
func (s *Ethereum) AccountManager() *accounts.Manager { return s.accountManager }
func (s *Ethereum) ChainManager() *core.ChainManager { return s.chainManager }