From 882f63676be9db49cf459f833c80429af21838e8 Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Tue, 7 Apr 2020 19:05:18 +0200 Subject: [PATCH] s/log/logger --- arc_cache.go | 4 ++-- blockstore.go | 8 ++++---- bloom_cache.go | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/arc_cache.go b/arc_cache.go index 405d22e..6e349d3 100644 --- a/arc_cache.go +++ b/arc_cache.go @@ -54,7 +54,7 @@ func (b *arccache) DeleteBlock(k cid.Cid) error { func (b *arccache) hasCached(k cid.Cid) (has bool, size int, ok bool) { b.total.Inc() if !k.Defined() { - log.Error("undefined cid in arccache") + 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, -1, false @@ -108,7 +108,7 @@ func (b *arccache) GetSize(k cid.Cid) (int, error) { func (b *arccache) Get(k cid.Cid) (blocks.Block, error) { if !k.Defined() { - log.Error("undefined cid in arc cache") + logger.Error("undefined cid in arc cache") return nil, ipld.ErrNotFound{k} } diff --git a/blockstore.go b/blockstore.go index e965dc5..b8f9ab2 100644 --- a/blockstore.go +++ b/blockstore.go @@ -18,7 +18,7 @@ import ( logging "github.com/ipfs/go-log" ) -var log = logging.Logger("blockstore") +var logger = logging.Logger("blockstore") // BlockPrefix namespaces blockstore datastores var BlockPrefix = ds.NewKey("blocks") @@ -114,7 +114,7 @@ func (bs *blockstore) HashOnRead(enabled bool) { func (bs *blockstore) Get(k cid.Cid) (blocks.Block, error) { if !k.Defined() { - log.Error("undefined cid in blockstore") + logger.Error("undefined cid in blockstore") return nil, ipld.ErrNotFound{k} } bdata, err := bs.datastore.Get(dshelp.MultihashToDsKey(k.Hash())) @@ -212,14 +212,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) diff --git a/bloom_cache.go b/bloom_cache.go index b1d64db..3cfa815 100644 --- a/bloom_cache.go +++ b/bloom_cache.go @@ -35,9 +35,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 } @@ -88,7 +88,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) @@ -125,7 +125,7 @@ func (b *bloomcache) DeleteBlock(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