Skip to content
This repository has been archived by the owner on Jun 19, 2023. It is now read-only.

Commit

Permalink
s/log/logger
Browse files Browse the repository at this point in the history
  • Loading branch information
hsanjuan committed Mar 2, 2022
1 parent 3eae524 commit 0d3fe7e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
3 changes: 3 additions & 0 deletions arc_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ func (b *arccache) DeleteBlock(ctx context.Context, k cid.Cid) error {

func (b *arccache) Has(ctx context.Context, k cid.Cid) (bool, error) {
if !k.Defined() {
logger.Error("undefined cid in arccache")
// Return cache invalid so the call to blockstore happens
// in case of invalid key and correct error is created.
return false, nil
}

Expand Down
6 changes: 3 additions & 3 deletions blockstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
uatomic "go.uber.org/atomic"
)

var log = logging.Logger("blockstore")
var logger = logging.Logger("blockstore")

// BlockPrefix namespaces blockstore datastores
var BlockPrefix = ds.NewKey("blocks")
Expand Down Expand Up @@ -239,14 +239,14 @@ func (bs *blockstore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error) {
return
}
if e.Error != nil {
log.Errorf("blockstore.AllKeysChan got err: %s", e.Error)
logger.Errorf("blockstore.AllKeysChan got err: %s", e.Error)
return
}

// need to convert to key.Key using key.KeyFromDsKey.
bk, err := dshelp.BinaryFromDsKey(ds.RawKey(e.Key))
if err != nil {
log.Warningf("error parsing key from binary: %s", err)
logger.Warningf("error parsing key from binary: %s", err)
continue
}
k := cid.NewCidV1(cid.Raw, bk)
Expand Down
8 changes: 4 additions & 4 deletions bloom_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ func bloomCached(ctx context.Context, bs Blockstore, bloomSize, hashCount int) (
if err != nil {
select {
case <-ctx.Done():
log.Warning("Cache rebuild closed by context finishing: ", err)
logger.Warning("Cache rebuild closed by context finishing: ", err)
default:
log.Error(err)
logger.Error(err)
}
return
}
Expand Down Expand Up @@ -95,7 +95,7 @@ func (b *bloomcache) Wait(ctx context.Context) error {
}

func (b *bloomcache) build(ctx context.Context) error {
evt := log.EventBegin(ctx, "bloomcache.build")
evt := logger.EventBegin(ctx, "bloomcache.build")
defer evt.Done()
defer close(b.buildChan)

Expand Down Expand Up @@ -132,7 +132,7 @@ func (b *bloomcache) DeleteBlock(ctx context.Context, k cid.Cid) error {
func (b *bloomcache) hasCached(k cid.Cid) (has bool, ok bool) {
b.total.Inc()
if !k.Defined() {
log.Error("undefined in bloom cache")
logger.Error("undefined in bloom cache")
// Return cache invalid so call to blockstore
// in case of invalid key is forwarded deeper
return false, false
Expand Down

0 comments on commit 0d3fe7e

Please sign in to comment.