aboutsummaryrefslogtreecommitdiffstats
path: root/swarm/swarm.go
diff options
context:
space:
mode:
Diffstat (limited to 'swarm/swarm.go')
-rw-r--r--swarm/swarm.go41
1 files changed, 20 insertions, 21 deletions
diff --git a/swarm/swarm.go b/swarm/swarm.go
index eab01f036..b2894c6e7 100644
--- a/swarm/swarm.go
+++ b/swarm/swarm.go
@@ -26,8 +26,7 @@ import (
"github.com/ethereum/go-ethereum/contracts/chequebook"
"github.com/ethereum/go-ethereum/contracts/ens"
"github.com/ethereum/go-ethereum/crypto"
- "github.com/ethereum/go-ethereum/logger"
- "github.com/ethereum/go-ethereum/logger/glog"
+ "github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/p2p/discover"
@@ -88,7 +87,7 @@ func NewSwarm(ctx *node.ServiceContext, backend chequebook.Backend, config *api.
privateKey: config.Swap.PrivateKey(),
corsString: cors,
}
- glog.V(logger.Debug).Infof("Setting up Swarm service components")
+ log.Debug(fmt.Sprintf("Setting up Swarm service components"))
hash := storage.MakeHashFunc(config.ChunkerParams.Hash)
self.lstore, err = storage.NewLocalStore(hash, config.StoreParams)
@@ -97,10 +96,10 @@ func NewSwarm(ctx *node.ServiceContext, backend chequebook.Backend, config *api.
}
// setup local store
- glog.V(logger.Debug).Infof("Set up local storage")
+ log.Debug(fmt.Sprintf("Set up local storage"))
self.dbAccess = network.NewDbAccess(self.lstore)
- glog.V(logger.Debug).Infof("Set up local db access (iterator/counter)")
+ log.Debug(fmt.Sprintf("Set up local db access (iterator/counter)"))
// set up the kademlia hive
self.hive = network.NewHive(
@@ -109,26 +108,26 @@ func NewSwarm(ctx *node.ServiceContext, backend chequebook.Backend, config *api.
swapEnabled, // SWAP enabled
syncEnabled, // syncronisation enabled
)
- glog.V(logger.Debug).Infof("Set up swarm network with Kademlia hive")
+ log.Debug(fmt.Sprintf("Set up swarm network with Kademlia hive"))
// setup cloud storage backend
cloud := network.NewForwarder(self.hive)
- glog.V(logger.Debug).Infof("-> set swarm forwarder as cloud storage backend")
+ log.Debug(fmt.Sprintf("-> set swarm forwarder as cloud storage backend"))
// setup cloud storage internal access layer
self.storage = storage.NewNetStore(hash, self.lstore, cloud, config.StoreParams)
- glog.V(logger.Debug).Infof("-> swarm net store shared access layer to Swarm Chunk Store")
+ log.Debug(fmt.Sprintf("-> swarm net store shared access layer to Swarm Chunk Store"))
// set up Depo (storage handler = cloud storage access layer for incoming remote requests)
self.depo = network.NewDepo(hash, self.lstore, self.storage)
- glog.V(logger.Debug).Infof("-> REmote Access to CHunks")
+ log.Debug(fmt.Sprintf("-> REmote Access to CHunks"))
// set up DPA, the cloud storage local access layer
dpaChunkStore := storage.NewDpaChunkStore(self.lstore, self.storage)
- glog.V(logger.Debug).Infof("-> Local Access to Swarm")
+ log.Debug(fmt.Sprintf("-> Local Access to Swarm"))
// Swarm Hash Merklised Chunking for Arbitrary-length Document/File storage
self.dpa = storage.NewDPA(dpaChunkStore, self.config.ChunkerParams)
- glog.V(logger.Debug).Infof("-> Content Store API")
+ log.Debug(fmt.Sprintf("-> Content Store API"))
// set up high level api
transactOpts := bind.NewKeyedTransactor(self.privateKey)
@@ -137,11 +136,11 @@ func NewSwarm(ctx *node.ServiceContext, backend chequebook.Backend, config *api.
if err != nil {
return nil, err
}
- glog.V(logger.Debug).Infof("-> Swarm Domain Name Registrar @ address %v", config.EnsRoot.Hex())
+ log.Debug(fmt.Sprintf("-> Swarm Domain Name Registrar @ address %v", config.EnsRoot.Hex()))
self.api = api.NewApi(self.dpa, self.dns)
// Manifests for Smart Hosting
- glog.V(logger.Debug).Infof("-> Web3 virtual server API")
+ log.Debug(fmt.Sprintf("-> Web3 virtual server API"))
return self, nil
}
@@ -173,21 +172,21 @@ func (self *Swarm) Start(net *p2p.Server) error {
if err != nil {
return fmt.Errorf("Unable to set chequebook for SWAP: %v", err)
}
- glog.V(logger.Debug).Infof("-> cheque book for SWAP: %v", self.config.Swap.Chequebook())
+ log.Debug(fmt.Sprintf("-> cheque book for SWAP: %v", self.config.Swap.Chequebook()))
} else {
- glog.V(logger.Debug).Infof("SWAP disabled: no cheque book set")
+ log.Debug(fmt.Sprintf("SWAP disabled: no cheque book set"))
}
- glog.V(logger.Warn).Infof("Starting Swarm service")
+ log.Warn(fmt.Sprintf("Starting Swarm service"))
self.hive.Start(
discover.PubkeyID(&net.PrivateKey.PublicKey),
func() string { return net.ListenAddr },
connectPeer,
)
- glog.V(logger.Info).Infof("Swarm network started on bzz address: %v", self.hive.Addr())
+ log.Info(fmt.Sprintf("Swarm network started on bzz address: %v", self.hive.Addr()))
self.dpa.Start()
- glog.V(logger.Debug).Infof("Swarm DPA started")
+ log.Debug(fmt.Sprintf("Swarm DPA started"))
// start swarm http proxy server
if self.config.Port != "" {
@@ -195,10 +194,10 @@ func (self *Swarm) Start(net *p2p.Server) error {
go httpapi.StartHttpServer(self.api, &httpapi.Server{Addr: addr, CorsString: self.corsString})
}
- glog.V(logger.Debug).Infof("Swarm http proxy started on port: %v", self.config.Port)
+ log.Debug(fmt.Sprintf("Swarm http proxy started on port: %v", self.config.Port))
if self.corsString != "" {
- glog.V(logger.Debug).Infof("Swarm http proxy started with corsdomain:", self.corsString)
+ log.Debug(fmt.Sprintf("Swarm http proxy started with corsdomain:", self.corsString))
}
return nil
@@ -279,7 +278,7 @@ func (self *Swarm) SetChequebook(ctx context.Context) error {
if err != nil {
return err
}
- glog.V(logger.Info).Infof("new chequebook set (%v): saving config file, resetting all connections in the hive", self.config.Swap.Contract.Hex())
+ log.Info(fmt.Sprintf("new chequebook set (%v): saving config file, resetting all connections in the hive", self.config.Swap.Contract.Hex()))
self.config.Save()
self.hive.DropAll()
return nil