aboutsummaryrefslogtreecommitdiffstats
path: root/swarm/storage/dbstore.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 /swarm/storage/dbstore.go
parent47af53f9aaf9aa7b12cd976eb150ccf3d64da6fd (diff)
downloaddexon-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.tar.gz
dexon-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.tar.zst
dexon-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.zip
all: blidly swap out glog to our log15, logs need rework
Diffstat (limited to 'swarm/storage/dbstore.go')
-rw-r--r--swarm/storage/dbstore.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/swarm/storage/dbstore.go b/swarm/storage/dbstore.go
index e320cd327..30925a919 100644
--- a/swarm/storage/dbstore.go
+++ b/swarm/storage/dbstore.go
@@ -28,8 +28,7 @@ import (
"fmt"
"sync"
- "github.com/ethereum/go-ethereum/logger"
- "github.com/ethereum/go-ethereum/logger/glog"
+ "github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/rlp"
"github.com/syndtr/goleveldb/leveldb"
"github.com/syndtr/goleveldb/leveldb/iterator"
@@ -279,7 +278,7 @@ func (s *DbStore) Cleanup() {
data, err := s.db.Get(getDataKey(index.Idx))
if err != nil {
- glog.V(logger.Warn).Infof("Chunk %x found but could not be accessed: %v", key[:], err)
+ log.Warn(fmt.Sprintf("Chunk %x found but could not be accessed: %v", key[:], err))
s.delete(index.Idx, getIndexKey(key[1:]))
errorsFound++
} else {
@@ -287,7 +286,7 @@ func (s *DbStore) Cleanup() {
hasher.Write(data)
hash := hasher.Sum(nil)
if !bytes.Equal(hash, key[1:]) {
- glog.V(logger.Warn).Infof("Found invalid chunk. Hash mismatch. hash=%x, key=%x", hash, key[:])
+ log.Warn(fmt.Sprintf("Found invalid chunk. Hash mismatch. hash=%x, key=%x", hash, key[:]))
s.delete(index.Idx, getIndexKey(key[1:]))
errorsFound++
}
@@ -295,7 +294,7 @@ func (s *DbStore) Cleanup() {
it.Next()
}
it.Release()
- glog.V(logger.Warn).Infof("Found %v errors out of %v entries", errorsFound, total)
+ log.Warn(fmt.Sprintf("Found %v errors out of %v entries", errorsFound, total))
}
func (s *DbStore) delete(idx uint64, idxKey []byte) {
@@ -324,7 +323,7 @@ func (s *DbStore) Put(chunk *Chunk) {
if chunk.dbStored != nil {
close(chunk.dbStored)
}
- glog.V(logger.Detail).Infof("Storing to DB: chunk already exists, only update access")
+ log.Trace(fmt.Sprintf("Storing to DB: chunk already exists, only update access"))
return // already exists, only update access
}
@@ -356,7 +355,7 @@ func (s *DbStore) Put(chunk *Chunk) {
if chunk.dbStored != nil {
close(chunk.dbStored)
}
- glog.V(logger.Detail).Infof("DbStore.Put: %v. db storage counter: %v ", chunk.Key.Log(), s.dataIdx)
+ log.Trace(fmt.Sprintf("DbStore.Put: %v. db storage counter: %v ", chunk.Key.Log(), s.dataIdx))
}
// try to find index; if found, update access cnt and return true
@@ -390,7 +389,7 @@ func (s *DbStore) Get(key Key) (chunk *Chunk, err error) {
var data []byte
data, err = s.db.Get(getDataKey(index.Idx))
if err != nil {
- glog.V(logger.Detail).Infof("DBStore: Chunk %v found but could not be accessed: %v", key.Log(), err)
+ log.Trace(fmt.Sprintf("DBStore: Chunk %v found but could not be accessed: %v", key.Log(), err))
s.delete(index.Idx, getIndexKey(key))
return
}