49 lines
1 KiB
Diff
49 lines
1 KiB
Diff
|
diff --git a/core/tracker.go b/core/tracker.go
|
||
|
index cb4e8b0..43a6b1d 100644
|
||
|
--- a/core/tracker.go
|
||
|
+++ b/core/tracker.go
|
||
|
@@ -2,6 +2,7 @@ package core
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
+ "log"
|
||
|
"os"
|
||
|
"path"
|
||
|
|
||
|
@@ -15,6 +16,26 @@ type Tracker struct {
|
||
|
txn *badger.Txn
|
||
|
}
|
||
|
|
||
|
+type logger struct {
|
||
|
+ *log.Logger
|
||
|
+}
|
||
|
+
|
||
|
+func (l *logger) Debugf(f string, v ...interface{}) {
|
||
|
+ return
|
||
|
+}
|
||
|
+
|
||
|
+func (l *logger) Infof(f string, v ...interface{}) {
|
||
|
+ return
|
||
|
+}
|
||
|
+
|
||
|
+func (l *logger) Warningf(f string, v ...interface{}) {
|
||
|
+ l.Printf("WARNING: "+f, v...)
|
||
|
+}
|
||
|
+
|
||
|
+func (l *logger) Errorf(f string, v ...interface{}) {
|
||
|
+ l.Printf("ERROR: "+f, v...)
|
||
|
+}
|
||
|
+
|
||
|
func NewTracker(gitPath string) (*Tracker, error) {
|
||
|
ipldDir := path.Join(gitPath, "ipld")
|
||
|
err := os.MkdirAll(ipldDir, 0755)
|
||
|
@@ -22,7 +43,7 @@ func NewTracker(gitPath string) (*Tracker, error) {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
- opt := badger.DefaultOptions(ipldDir)
|
||
|
+ opt := badger.DefaultOptions(ipldDir).WithLogger(&logger{Logger: log.New(os.Stderr, "badger ", log.LstdFlags)})
|
||
|
|
||
|
db, err := badger.Open(opt)
|
||
|
if err != nil {
|