Skip to content

Commit

Permalink
fix(everything) log.Debug -> log.Debugf
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Tiger Chow committed Oct 30, 2014
1 parent b5fc3ca commit b889524
Show file tree
Hide file tree
Showing 26 changed files with 61 additions and 61 deletions.
6 changes: 3 additions & 3 deletions blockservice/blockservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (s *BlockService) GetBlock(ctx context.Context, k u.Key) (*blocks.Block, er
log.Debugf("BlockService GetBlock: '%s'", k)
datai, err := s.Datastore.Get(k.DsKey())
if err == nil {
log.Debug("Blockservice: Got data in datastore.")
log.Debugf("Blockservice: Got data in datastore.")
bdata, ok := datai.([]byte)
if !ok {
return nil, fmt.Errorf("data associated with %s is not a []byte", k)
Expand All @@ -80,14 +80,14 @@ func (s *BlockService) GetBlock(ctx context.Context, k u.Key) (*blocks.Block, er
Data: bdata,
}, nil
} else if err == ds.ErrNotFound && s.Remote != nil {
log.Debug("Blockservice: Searching bitswap.")
log.Debugf("Blockservice: Searching bitswap.")
blk, err := s.Remote.Block(ctx, k)
if err != nil {
return nil, err
}
return blk, nil
} else {
log.Debug("Blockservice GetBlock: Not found.")
log.Debugf("Blockservice GetBlock: Not found.")
return nil, ErrNotFound
}
}
Expand Down
4 changes: 2 additions & 2 deletions core/commands/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions core/commands/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion core/commands/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

func Publish(n *core.IpfsNode, args []string, opts map[string]interface{}, out io.Writer) error {
log.Debug("Begin Publish")
log.Debugf("Begin Publish")

if n.Identity == nil {
return errors.New("Identity not loaded!")
Expand Down
2 changes: 1 addition & 1 deletion daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion daemon/daemon_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions diagnostics/diag.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@ func newID() string {
}

func (d *Diagnostics) GetDiagnostic(timeout time.Duration) ([]*DiagInfo, error) {
log.Debug("Getting diagnostic.")
log.Debugf("Getting diagnostic.")
ctx, _ := context.WithTimeout(context.TODO(), timeout)

diagID := newID()
d.diagLock.Lock()
d.diagMap[diagID] = time.Now()
d.diagLock.Unlock()

log.Debug("Begin Diagnostic")
log.Debugf("Begin Diagnostic")

peers := d.getPeers()
log.Debugf("Sending diagnostic request to %d peers.", len(peers))
Expand Down
2 changes: 1 addition & 1 deletion exchange/bitswap/bitswap.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func (bs *bitswap) ReceiveMessage(ctx context.Context, p peer.Peer, incoming bsm
}
defer bs.strategy.MessageSent(p, message)

log.Debug("Returning message.")
log.Debugf("Returning message.")
return p, message
}

Expand Down
4 changes: 2 additions & 2 deletions fuse/ipns/ipns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,10 @@ func TestFastRepublish(t *testing.T) {
fname := mnt.Dir + "/local/file"

// get first resolved hash
log.Debug("publishing first hash")
log.Debugf("publishing first hash")
writeFileData(t, dataA, fname) // random
<-time.After(shortRepublishTimeout * 11 / 10)
log.Debug("resolving first hash")
log.Debugf("resolving first hash")
resolvedHash, err := node.Namesys.Resolve(pubkeyHash)
if err != nil {
t.Fatal("resolve err:", pubkeyHash, err)
Expand Down
16 changes: 8 additions & 8 deletions fuse/ipns/ipns_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func (s *Root) Lookup(name string, intr fs.Intr) (fs.Node, fuse.Error) {

// ReadDir reads a particular directory. Disallowed for root.
func (r *Root) ReadDir(intr fs.Intr) ([]fuse.Dirent, fuse.Error) {
log.Debug("Read Root.")
log.Debugf("Read Root.")
listing := []fuse.Dirent{
fuse.Dirent{
Name: "local",
Expand Down Expand Up @@ -276,7 +276,7 @@ func (n *Node) makeChild(name string, node *mdag.Node) *Node {

// ReadDir reads the link structure as directory entries
func (s *Node) ReadDir(intr fs.Intr) ([]fuse.Dirent, fuse.Error) {
log.Debug("Node ReadDir")
log.Debugf("Node ReadDir")
entries := make([]fuse.Dirent, len(s.Nd.Links))
for i, link := range s.Nd.Links {
n := link.Name
Expand Down Expand Up @@ -341,7 +341,7 @@ func (n *Node) Flush(req *fuse.FlushRequest, intr fs.Intr) fuse.Error {
}

if n.parent != nil {
log.Debug("updating self in parent!")
log.Debugf("updating self in parent!")
err := n.parent.update(n.name, newNode)
if err != nil {
log.Criticalf("error in updating ipns dag tree: %s", err)
Expand Down Expand Up @@ -384,7 +384,7 @@ func (n *Node) wasChanged() {
}

func (n *Node) republishRoot() error {
log.Debug("Republish root")
log.Debugf("Republish root")

// We should already be the root, this is just a sanity check
var root *Node
Expand All @@ -406,7 +406,7 @@ func (n *Node) republishRoot() error {
log.Errorf("getKey error: %s", err)
return err
}
log.Debug("Publishing changes!")
log.Debugf("Publishing changes!")

err = n.Ipfs.Namesys.Publish(root.key, ndkey.Pretty())
if err != nil {
Expand All @@ -417,12 +417,12 @@ func (n *Node) republishRoot() error {
}

func (n *Node) Fsync(req *fuse.FsyncRequest, intr fs.Intr) fuse.Error {
log.Debug("Got fsync request!")
log.Debugf("Got fsync request!")
return nil
}

func (n *Node) Mkdir(req *fuse.MkdirRequest, intr fs.Intr) (fs.Node, fuse.Error) {
log.Debug("Got mkdir request!")
log.Debugf("Got mkdir request!")
dagnd := &mdag.Node{Data: ft.FolderPBData()}
nnode := n.Nd.Copy()
nnode.AddNodeLink(req.Name, dagnd)
Expand Down Expand Up @@ -467,7 +467,7 @@ func (n *Node) Open(req *fuse.OpenRequest, resp *fuse.OpenResponse, intr fs.Intr
}

func (n *Node) Mknod(req *fuse.MknodRequest, intr fs.Intr) (fs.Node, fuse.Error) {
log.Debug("Got mknod request!")
log.Debugf("Got mknod request!")
return nil, nil
}

Expand Down
4 changes: 2 additions & 2 deletions fuse/ipns/link_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ type Link struct {
}

func (l *Link) Attr() fuse.Attr {
log.Debug("Link attr.")
log.Debugf("Link attr.")
return fuse.Attr{
Mode: os.ModeSymlink | 0555,
}
}

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
}
10 changes: 5 additions & 5 deletions fuse/readonly/readonly_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (s *Root) Lookup(name string, intr fs.Intr) (fs.Node, fuse.Error) {

// ReadDir reads a particular directory. Disallowed for root.
func (*Root) ReadDir(intr fs.Intr) ([]fuse.Dirent, fuse.Error) {
log.Debug("Read Root.")
log.Debugf("Read Root.")
return nil, fuse.EPERM
}

Expand All @@ -91,7 +91,7 @@ func (s *Node) loadData() error {

// Attr returns the attributes of a given node.
func (s *Node) Attr() fuse.Attr {
log.Debug("Node attr.")
log.Debugf("Node attr.")
if s.cached == nil {
s.loadData()
}
Expand All @@ -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.
Expand All @@ -125,7 +125,7 @@ func (s *Node) Lookup(name string, intr fs.Intr) (fs.Node, fuse.Error) {

// ReadDir reads the link structure as directory entries
func (s *Node) ReadDir(intr fs.Intr) ([]fuse.Dirent, fuse.Error) {
log.Debug("Node ReadDir")
log.Debugf("Node ReadDir")
entries := make([]fuse.Dirent, len(s.Nd.Links))
for i, link := range s.Nd.Links {
n := link.Name
Expand All @@ -143,7 +143,7 @@ func (s *Node) ReadDir(intr fs.Intr) ([]fuse.Dirent, fuse.Error) {

// ReadAll reads the object data as file data
func (s *Node) ReadAll(intr fs.Intr) ([]byte, fuse.Error) {
log.Debug("Read node.")
log.Debugf("Read node.")
r, err := uio.NewDagReader(s.Nd, s.Ipfs.DAG)
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion merkledag/merkledag.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
2 changes: 1 addition & 1 deletion namesys/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion namesys/routing.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion net/conn/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 3 additions & 3 deletions net/swarm/swarm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions path/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -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, "/")
Expand All @@ -40,11 +40,11 @@ func (s *Resolver) ResolvePath(fpath string) (*merkledag.Node, error) {
// first element in the path is a b58 hash (for now)
h, err := mh.FromB58String(parts[0])
if err != nil {
log.Debug("given path element is not a base58 string.\n")
log.Debugf("given path element is not a base58 string.\n")
return nil, err
}

log.Debug("Resolve dag get.\n")
log.Debugf("Resolve dag get.\n")
nd, err := s.DAG.Get(u.Key(h))
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion pin/indirect.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
6 changes: 3 additions & 3 deletions routing/dht/dht.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ func (dht *IpfsDHT) getValueOrPeers(ctx context.Context, p peer.Peer,
log.Debugf("pmes.GetValue() %v", pmes.GetValue())
if value := pmes.GetValue(); value != nil {
// Success! We were given the value
log.Debug("getValueOrPeers: got value")
log.Debugf("getValueOrPeers: got value")
return value, nil, nil
}

Expand All @@ -269,7 +269,7 @@ func (dht *IpfsDHT) getValueOrPeers(ctx context.Context, p peer.Peer,
if err != nil {
return nil, nil, err
}
log.Debug("getValueOrPeers: get from providers")
log.Debugf("getValueOrPeers: get from providers")
return val, nil, nil
}

Expand All @@ -285,7 +285,7 @@ func (dht *IpfsDHT) getValueOrPeers(ctx context.Context, p peer.Peer,
}

if len(peers) > 0 {
log.Debug("getValueOrPeers: peers")
log.Debugf("getValueOrPeers: peers")
return nil, peers, nil
}

Expand Down
2 changes: 1 addition & 1 deletion routing/dht/dht_logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (l *logDhtRPC) Print() {
if err != nil {
log.Debugf("Error marshaling logDhtRPC object: %s", err)
} else {
log.Debug(string(b))
log.Debugf(string(b))
}
}

Expand Down
Loading

0 comments on commit b889524

Please sign in to comment.