Use go-logr
This commit is contained in:
11
db/db.go
11
db/db.go
@ -9,10 +9,16 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"go.balki.me/tss/log"
|
||||
"github.com/go-logr/logr"
|
||||
"go.balki.me/tss/parser"
|
||||
)
|
||||
|
||||
var log = logr.Discard()
|
||||
|
||||
func SetLogger(log logr.Logger) {
|
||||
log = log
|
||||
}
|
||||
|
||||
type Status string
|
||||
|
||||
const (
|
||||
@ -64,7 +70,8 @@ func NewDB(storageDir, feedName string) (DB, error) {
|
||||
reader := csv.NewReader(f)
|
||||
records, err := reader.ReadAll()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to parse csv, path:%v, error:%w", dbPath, err)
|
||||
log.Error(err, "failed to parse csv", "path", dbPath)
|
||||
return nil, err
|
||||
}
|
||||
for _, rec := range records {
|
||||
var recStatus Status = Status(rec[2])
|
||||
|
Reference in New Issue
Block a user