1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-29 09:34:03 +08:00

ipnsfs: remove "Publishing!" println

use `log.Info(...)` and `defer log.Event(...).Done()` instead

License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
This commit is contained in:
Juan Batiz-Benet
2015-07-28 23:51:56 -07:00
parent 4ff5923428
commit d4037f5f88

View File

@ -12,7 +12,6 @@ package ipnsfs
import (
"errors"
"fmt"
"os"
"sync"
"time"
@ -119,7 +118,8 @@ type FSNode interface {
// KeyRoot represents the root of a filesystem tree pointed to by a given keypair
type KeyRoot struct {
key ci.PrivKey
key ci.PrivKey
name string
// node is the merkledag node pointed to by this keypair
node *dag.Node
@ -146,6 +146,7 @@ func (fs *Filesystem) newKeyRoot(parent context.Context, k ci.PrivKey) (*KeyRoot
root := new(KeyRoot)
root.key = k
root.fs = fs
root.name = name
ctx, cancel := context.WithCancel(parent)
defer cancel()
@ -230,8 +231,13 @@ func (kr *KeyRoot) Publish(ctx context.Context) error {
// otherwise we are holding the lock through a costly
// network operation
fmt.Println("Publishing!")
return kr.fs.nsys.Publish(ctx, kr.key, path.FromKey(k))
kp := path.FromKey(k)
ev := &eventlog.Metadata{"name": kr.name, "key": kp}
defer log.EventBegin(ctx, "ipnsfsPublishing", ev).Done()
log.Info("ipnsfs publishing %s -> %s", kr.name, kp)
return kr.fs.nsys.Publish(ctx, kr.key, kp)
}
// Republisher manages when to publish the ipns entry associated with a given key