ipnsfs: remove "Publishing!" println
use `log.Info(...)` and `defer log.Event(...).Done()` instead License: MIT Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
Juan Batiz-Benet committed
Jul 28, 2015 at 23:51 UTC
d4037f5f889b4f17dc7685629a9d021a676ae4d5
1 file changed
+10
-4
ipnsfs/system.go
+10
-4
@@ -12,7 +12,6 @@ package ipnsfs
12
13
import (
14
"errors"
15
- "fmt"
15
"os"
16
"sync"
17
"time"
@@ -119,7 +118,8 @@ type FSNode interface {
118
119
// KeyRoot represents the root of a filesystem tree pointed to by a given keypair
120
type KeyRoot struct {
122
- key ci.PrivKey
121
+ key ci.PrivKey
122
+ name string
123
124
// node is the merkledag node pointed to by this keypair
125
node *dag.Node
@@ -146,6 +146,7 @@ func (fs *Filesystem) newKeyRoot(parent context.Context, k ci.PrivKey) (*KeyRoot
146
root := new(KeyRoot)
147
root.key = k
148
root.fs = fs
149
+ root.name = name
150
151
ctx, cancel := context.WithCancel(parent)
152
defer cancel()
@@ -230,8 +231,13 @@ func (kr *KeyRoot) Publish(ctx context.Context) error {
231
// otherwise we are holding the lock through a costly
232
// network operation
233
233
- fmt.Println("Publishing!")
234
- return kr.fs.nsys.Publish(ctx, kr.key, path.FromKey(k))
234
+ kp := path.FromKey(k)
235
+
236
+ ev := &eventlog.Metadata{"name": kr.name, "key": kp}
237
+ defer log.EventBegin(ctx, "ipnsfsPublishing", ev).Done()
238
+ log.Info("ipnsfs publishing %s -> %s", kr.name, kp)
239
+
240
+ return kr.fs.nsys.Publish(ctx, kr.key, kp)
241
}
242
243
// Republisher manages when to publish the ipns entry associated with a given key