From d4037f5f889b4f17dc7685629a9d021a676ae4d5 Mon Sep 17 00:00:00 2001 From: Juan Batiz-Benet Date: Tue, 28 Jul 2015 23:51:56 -0700 Subject: [PATCH] ipnsfs: remove "Publishing!" println use `log.Info(...)` and `defer log.Event(...).Done()` instead License: MIT Signed-off-by: Juan Batiz-Benet --- ipnsfs/system.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ipnsfs/system.go b/ipnsfs/system.go index b1e4998b2..f69622729 100644 --- a/ipnsfs/system.go +++ b/ipnsfs/system.go @@ -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