Use go-logr

This commit is contained in:
2022-06-17 18:23:06 -04:00
parent 7e92a042ff
commit 962c533fff
5 changed files with 32 additions and 52 deletions

View File

@ -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])