aboutsummaryrefslogtreecommitdiffstats
path: root/ethdb/database.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 /ethdb/database.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 'ethdb/database.go')
-rw-r--r--ethdb/database.go24
1 files changed, 11 insertions, 13 deletions
diff --git a/ethdb/database.go b/ethdb/database.go
index c0e92a87b..e82528f25 100644
--- a/ethdb/database.go
+++ b/ethdb/database.go
@@ -17,14 +17,14 @@
package ethdb
import (
+ "fmt"
"path/filepath"
"strconv"
"strings"
"sync"
"time"
- "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/syndtr/goleveldb/leveldb"
"github.com/syndtr/goleveldb/leveldb/errors"
@@ -80,7 +80,7 @@ func NewLDBDatabase(file string, cache int, handles int) (*LDBDatabase, error) {
if handles < 16 {
handles = 16
}
- glog.V(logger.Info).Infof("Allotted %dMB cache and %d file handles to %s", cache, handles, file)
+ log.Info(fmt.Sprintf("Allotted %dMB cache and %d file handles to %s", cache, handles, file))
// Open the db and recover any potential corruptions
db, err := leveldb.OpenFile(file, &opt.Options{
@@ -167,16 +167,14 @@ func (self *LDBDatabase) Close() {
errc := make(chan error)
self.quitChan <- errc
if err := <-errc; err != nil {
- glog.V(logger.Error).Infof("metrics failure in '%s': %v\n", self.fn, err)
+ log.Error(fmt.Sprintf("metrics failure in '%s': %v\n", self.fn, err))
}
}
err := self.db.Close()
- if glog.V(logger.Error) {
- if err == nil {
- glog.Infoln("closed db:", self.fn)
- } else {
- glog.Errorf("error closing db %s: %v", self.fn, err)
- }
+ if err == nil {
+ log.Info(fmt.Sprint("closed db:", self.fn))
+ } else {
+ log.Error(fmt.Sprintf("error closing db %s: %v", self.fn, err))
}
}
@@ -231,7 +229,7 @@ func (self *LDBDatabase) meter(refresh time.Duration) {
// Retrieve the database stats
stats, err := self.db.GetProperty("leveldb.stats")
if err != nil {
- glog.V(logger.Error).Infof("failed to read database stats: %v", err)
+ log.Error(fmt.Sprintf("failed to read database stats: %v", err))
return
}
// Find the compaction table, skip the header
@@ -240,7 +238,7 @@ func (self *LDBDatabase) meter(refresh time.Duration) {
lines = lines[1:]
}
if len(lines) <= 3 {
- glog.V(logger.Error).Infof("compaction table not found")
+ log.Error(fmt.Sprintf("compaction table not found"))
return
}
lines = lines[3:]
@@ -256,7 +254,7 @@ func (self *LDBDatabase) meter(refresh time.Duration) {
}
for idx, counter := range parts[3:] {
if value, err := strconv.ParseFloat(strings.TrimSpace(counter), 64); err != nil {
- glog.V(logger.Error).Infof("compaction entry parsing failed: %v", err)
+ log.Error(fmt.Sprintf("compaction entry parsing failed: %v", err))
return
} else {
counters[i%2][idx] += value