From cea398b8a7644d972bc9f3c75c728289d3b162b5 Mon Sep 17 00:00:00 2001 From: Brian Tiger Chow Date: Thu, 30 Oct 2014 06:35:29 -0700 Subject: [PATCH] fix(all) log.Debug -> log.Debugf --- core/commands/block.go | 4 ++-- core/commands/object.go | 6 +++--- daemon/daemon.go | 2 +- daemon/daemon_client.go | 2 +- fuse/ipns/link_unix.go | 2 +- fuse/readonly/readonly_unix.go | 2 +- merkledag/merkledag.go | 2 +- namesys/publisher.go | 2 +- namesys/routing.go | 2 +- net/conn/conn.go | 2 +- net/swarm/swarm_test.go | 6 +++--- path/path.go | 2 +- pin/indirect.go | 2 +- routing/dht/ext_test.go | 2 +- routing/dht/query.go | 20 ++++++++++---------- routing/dht/routing.go | 2 +- 16 files changed, 30 insertions(+), 30 deletions(-) diff --git a/core/commands/block.go b/core/commands/block.go index 0813e9c3c88..2448d6977a6 100644 --- a/core/commands/block.go +++ b/core/commands/block.go @@ -28,7 +28,7 @@ func BlockGet(n *core.IpfsNode, args []string, opts map[string]interface{}, out } k := u.Key(h) - log.Debug("BlockGet key: '%q'", k) + log.Debugf("BlockGet key: '%q'", k) ctx, _ := context.WithTimeout(context.TODO(), time.Second*5) b, err := n.Blocks.GetBlock(ctx, k) if err != nil { @@ -48,7 +48,7 @@ func BlockPut(n *core.IpfsNode, args []string, opts map[string]interface{}, out } b := blocks.NewBlock(data) - log.Debug("BlockPut key: '%q'", b.Key()) + log.Debugf("BlockPut key: '%q'", b.Key()) k, err := n.Blocks.AddBlock(b) if err != nil { diff --git a/core/commands/object.go b/core/commands/object.go index 5d0ccddabc6..24386a173c0 100644 --- a/core/commands/object.go +++ b/core/commands/object.go @@ -19,7 +19,7 @@ func ObjectData(n *core.IpfsNode, args []string, opts map[string]interface{}, ou if err != nil { return fmt.Errorf("objectData error: %v", err) } - log.Debug("objectData: found dagnode %q (# of bytes: %d - # links: %d)", args[0], len(dagnode.Data), len(dagnode.Links)) + log.Debugf("objectData: found dagnode %q (# of bytes: %d - # links: %d)", args[0], len(dagnode.Data), len(dagnode.Links)) _, err = io.Copy(out, bytes.NewReader(dagnode.Data)) return err @@ -31,7 +31,7 @@ func ObjectLinks(n *core.IpfsNode, args []string, opts map[string]interface{}, o if err != nil { return fmt.Errorf("objectLinks error: %v", err) } - log.Debug("ObjectLinks: found dagnode %q (# of bytes: %d - # links: %d)", args[0], len(dagnode.Data), len(dagnode.Links)) + log.Debugf("ObjectLinks: found dagnode %q (# of bytes: %d - # links: %d)", args[0], len(dagnode.Data), len(dagnode.Links)) for _, link := range dagnode.Links { _, err = fmt.Fprintf(out, "%s %d %q\n", link.Hash.B58String(), link.Size, link.Name) @@ -70,7 +70,7 @@ func ObjectGet(n *core.IpfsNode, args []string, opts map[string]interface{}, out if err != nil { return fmt.Errorf("ObjectGet error: %v", err) } - log.Debug("objectGet: found dagnode %q (# of bytes: %d - # links: %d)", args[0], len(dagnode.Data), len(dagnode.Links)) + log.Debugf("objectGet: found dagnode %q (# of bytes: %d - # links: %d)", args[0], len(dagnode.Data), len(dagnode.Links)) // sadly all encodings dont implement a common interface var data []byte diff --git a/daemon/daemon.go b/daemon/daemon.go index c8c150a8d16..dfddf0625ad 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -117,7 +117,7 @@ func (dl *DaemonListener) handleConnection(conn manet.Conn) { return } - log.Debug("Got command: %v", command) + log.Debugf("Got command: %v", command) switch command.Command { case "add": err = commands.Add(dl.node, command.Args, command.Opts, conn) diff --git a/daemon/daemon_client.go b/daemon/daemon_client.go index 031d439c4a8..e894756e7f8 100644 --- a/daemon/daemon_client.go +++ b/daemon/daemon_client.go @@ -25,7 +25,7 @@ func getDaemonAddr(confdir string) (string, error) { } fi, err := os.Open(confdir + "/rpcaddress") if err != nil { - log.Debug("getDaemonAddr failed: %s", err) + log.Debugf("getDaemonAddr failed: %s", err) if err == os.ErrNotExist { return "", ErrDaemonNotRunning } diff --git a/fuse/ipns/link_unix.go b/fuse/ipns/link_unix.go index e81576c6e66..fcaada15f14 100644 --- a/fuse/ipns/link_unix.go +++ b/fuse/ipns/link_unix.go @@ -19,6 +19,6 @@ func (l *Link) Attr() fuse.Attr { } func (l *Link) Readlink(req *fuse.ReadlinkRequest, intr fs.Intr) (string, fuse.Error) { - log.Debug("ReadLink: %s", l.Target) + log.Debugf("ReadLink: %s", l.Target) return l.Target, nil } diff --git a/fuse/readonly/readonly_unix.go b/fuse/readonly/readonly_unix.go index de72a71646e..e3623547342 100644 --- a/fuse/readonly/readonly_unix.go +++ b/fuse/readonly/readonly_unix.go @@ -113,7 +113,7 @@ func (s *Node) Attr() fuse.Attr { // Lookup performs a lookup under this node. func (s *Node) Lookup(name string, intr fs.Intr) (fs.Node, fuse.Error) { - log.Debug("Lookup '%s'", name) + log.Debugf("Lookup '%s'", name) nd, err := s.Ipfs.Resolver.ResolveLinks(s.Nd, []string{name}) if err != nil { // todo: make this error more versatile. diff --git a/merkledag/merkledag.go b/merkledag/merkledag.go index 92fa6e48efa..3134899bd63 100644 --- a/merkledag/merkledag.go +++ b/merkledag/merkledag.go @@ -175,7 +175,7 @@ type dagService struct { // Add adds a node to the dagService, storing the block in the BlockService func (n *dagService) Add(nd *Node) (u.Key, error) { k, _ := nd.Key() - log.Debug("DagService Add [%s]", k) + log.Debugf("DagService Add [%s]", k) if n == nil { return "", fmt.Errorf("dagService is nil") } diff --git a/namesys/publisher.go b/namesys/publisher.go index 7203fb1d4a4..d95f1cbbcf9 100644 --- a/namesys/publisher.go +++ b/namesys/publisher.go @@ -27,7 +27,7 @@ func NewRoutingPublisher(route routing.IpfsRouting) Publisher { // Publish implements Publisher. Accepts a keypair and a value, func (p *ipnsPublisher) Publish(k ci.PrivKey, value string) error { - log.Debug("namesys: Publish %s", value) + log.Debugf("namesys: Publish %s", value) // validate `value` is a ref (multihash) _, err := mh.FromB58String(value) diff --git a/namesys/routing.go b/namesys/routing.go index ce1755f6924..6259705ec92 100644 --- a/namesys/routing.go +++ b/namesys/routing.go @@ -35,7 +35,7 @@ func (r *routingResolver) CanResolve(name string) bool { // Resolve implements Resolver. Uses the IPFS routing system to resolve SFS-like // names. func (r *routingResolver) Resolve(name string) (string, error) { - log.Debug("RoutingResolve: '%s'", name) + log.Debugf("RoutingResolve: '%s'", name) ctx := context.TODO() hash, err := mh.FromB58String(name) if err != nil { diff --git a/net/conn/conn.go b/net/conn/conn.go index 3df82d15d52..eb262c9fa2a 100644 --- a/net/conn/conn.go +++ b/net/conn/conn.go @@ -89,7 +89,7 @@ func newSingleConn(ctx context.Context, local, remote peer.Peer, // close is the internal close function, called by ContextCloser.Close func (c *singleConn) close() error { - log.Debug("%s closing Conn with %s", c.local, c.remote) + log.Debugf("%s closing Conn with %s", c.local, c.remote) // close underlying connection err := c.maconn.Close() diff --git a/net/swarm/swarm_test.go b/net/swarm/swarm_test.go index b4a9b02780a..9fc9ab1f99c 100644 --- a/net/swarm/swarm_test.go +++ b/net/swarm/swarm_test.go @@ -25,7 +25,7 @@ func pong(ctx context.Context, swarm *Swarm) { if bytes.Equal(m1.Data(), []byte("ping")) { m2 := msg.New(m1.Peer(), []byte("pong")) i++ - log.Debug("%s pong %s (%d)", swarm.local, m1.Peer(), i) + log.Debugf("%s pong %s (%d)", swarm.local, m1.Peer(), i) swarm.Outgoing <- m2 } } @@ -130,14 +130,14 @@ func SubtestSwarm(t *testing.T, addrs []string, MsgNum int) { for k := 0; k < MsgNum; k++ { for _, p := range *peers { - log.Debug("%s ping %s (%d)", s1.local, p, k) + log.Debugf("%s ping %s (%d)", s1.local, p, k) s1.Outgoing <- msg.New(p, []byte("ping")) } } got := map[u.Key]int{} for k := 0; k < (MsgNum * len(*peers)); k++ { - log.Debug("%s waiting for pong (%d)", s1.local, k) + log.Debugf("%s waiting for pong (%d)", s1.local, k) msg := <-s1.Incoming if string(msg.Data()) != "pong" { t.Error("unexpected conn output", msg.Data) diff --git a/path/path.go b/path/path.go index cb1061d1185..8d3070a0eee 100644 --- a/path/path.go +++ b/path/path.go @@ -22,7 +22,7 @@ type Resolver struct { // path component as a hash (key) of the first node, then resolves // all other components walking the links, with ResolveLinks. func (s *Resolver) ResolvePath(fpath string) (*merkledag.Node, error) { - log.Debug("Resolve: '%s'", fpath) + log.Debugf("Resolve: '%s'", fpath) fpath = path.Clean(fpath) parts := strings.Split(fpath, "/") diff --git a/pin/indirect.go b/pin/indirect.go index 2eb303de2ba..b15b720ee75 100644 --- a/pin/indirect.go +++ b/pin/indirect.go @@ -32,7 +32,7 @@ func loadIndirPin(d ds.Datastore, k ds.Key) (*indirectPin, error) { keys = append(keys, k) refcnt[k] = v } - log.Debug("indirPin keys: %#v", keys) + log.Debugf("indirPin keys: %#v", keys) return &indirectPin{blockset: set.SimpleSetFromKeys(keys), refCounts: refcnt}, nil } diff --git a/routing/dht/ext_test.go b/routing/dht/ext_test.go index 77684db285f..19275338da2 100644 --- a/routing/dht/ext_test.go +++ b/routing/dht/ext_test.go @@ -245,7 +245,7 @@ func TestNotFound(t *testing.T) { ctx, _ = context.WithTimeout(ctx, time.Second*5) v, err := d.GetValue(ctx, u.Key("hello")) - log.Debug("get value got %v", v) + log.Debugf("get value got %v", v) if err != nil { switch err { case routing.ErrNotFound: diff --git a/routing/dht/query.go b/routing/dht/query.go index 48974b8eb0a..cd9fae98c00 100644 --- a/routing/dht/query.go +++ b/routing/dht/query.go @@ -107,7 +107,7 @@ func newQueryRunner(ctx context.Context, q *dhtQuery) *dhtQueryRunner { } func (r *dhtQueryRunner) Run(peers []peer.Peer) (*dhtQueryResult, error) { - log.Debug("Run query with %d peers.", len(peers)) + log.Debugf("Run query with %d peers.", len(peers)) if len(peers) == 0 { log.Warning("Running query with no peers!") return nil, nil @@ -176,7 +176,7 @@ func (r *dhtQueryRunner) addPeerToQuery(next peer.Peer, benchmark peer.Peer) { r.peersSeen[next.Key()] = next r.Unlock() - log.Debug("adding peer to query: %v\n", next) + log.Debugf("adding peer to query: %v\n", next) // do this after unlocking to prevent possible deadlocks. r.peersRemaining.Increment(1) @@ -200,14 +200,14 @@ func (r *dhtQueryRunner) spawnWorkers() { if !more { return // channel closed. } - log.Debug("spawning worker for: %v\n", p) + log.Debugf("spawning worker for: %v\n", p) go r.queryPeer(p) } } } func (r *dhtQueryRunner) queryPeer(p peer.Peer) { - log.Debug("spawned worker for: %v\n", p) + log.Debugf("spawned worker for: %v\n", p) // make sure we rate limit concurrency. select { @@ -218,12 +218,12 @@ func (r *dhtQueryRunner) queryPeer(p peer.Peer) { } // ok let's do this! - log.Debug("running worker for: %v", p) + log.Debugf("running worker for: %v", p) // make sure we do this when we exit defer func() { // signal we're done proccessing peer p - log.Debug("completing worker for: %v", p) + log.Debugf("completing worker for: %v", p) r.peersRemaining.Decrement(1) r.rateLimit <- struct{}{} }() @@ -232,7 +232,7 @@ func (r *dhtQueryRunner) queryPeer(p peer.Peer) { // (Incidentally, this will add it to the peerstore too) err := r.query.dialer.DialPeer(p) if err != nil { - log.Debug("ERROR worker for: %v -- err connecting: %v", p, err) + log.Debugf("ERROR worker for: %v -- err connecting: %v", p, err) r.Lock() r.errs = append(r.errs, err) r.Unlock() @@ -243,20 +243,20 @@ func (r *dhtQueryRunner) queryPeer(p peer.Peer) { res, err := r.query.qfunc(r.ctx, p) if err != nil { - log.Debug("ERROR worker for: %v %v", p, err) + log.Debugf("ERROR worker for: %v %v", p, err) r.Lock() r.errs = append(r.errs, err) r.Unlock() } else if res.success { - log.Debug("SUCCESS worker for: %v", p, res) + log.Debugf("SUCCESS worker for: %v", p, res) r.Lock() r.result = res r.Unlock() r.cancel() // signal to everyone that we're done. } else if res.closerPeers != nil { - log.Debug("PEERS CLOSER -- worker for: %v\n", p) + log.Debugf("PEERS CLOSER -- worker for: %v\n", p) for _, next := range res.closerPeers { r.addPeerToQuery(next, p) } diff --git a/routing/dht/routing.go b/routing/dht/routing.go index 44edd99a7a0..da400fee288 100644 --- a/routing/dht/routing.go +++ b/routing/dht/routing.go @@ -247,7 +247,7 @@ func (dht *IpfsDHT) FindPeer(ctx context.Context, id peer.ID) (peer.Peer, error) return nil, err } - log.Debug("FindPeer %v %v", id, result.success) + log.Debugf("FindPeer %v %v", id, result.success) if result.peer == nil { return nil, routing.ErrNotFound }