some small cleanup of logging
Jeromy committed
Oct 30, 2014 at 05:55 UTC
ce223eef6179d7d9b95f3c24ec9fbd527b714980
2 files changed
+11
-6
core/commands/add.go
+3
-3
@@ -82,7 +82,7 @@ func addDir(n *core.IpfsNode, fpath string, depth int, out io.Writer) (*dag.Node
82
}
83
}
84
85
- log.Info("adding dir: %s", fpath)
85
+ log.Infof("adding dir: %s", fpath)
86
87
return tree, addNode(n, tree, fpath, out)
88
}
@@ -98,10 +98,10 @@ func addFile(n *core.IpfsNode, fpath string, depth int, out io.Writer) (*dag.Nod
98
return nil, err
99
}
100
101
- log.Info("adding file: %s", fpath)
101
+ log.Infof("adding file: %s", fpath)
102
103
for _, l := range root.Links {
104
- log.Info("adding subblock: %s %s", l.Name, l.Hash.B58String())
104
+ log.Infof("adding subblock: '%s' %s", l.Name, l.Hash.B58String())
105
}
106
107
k, err := root.Key()
unixfs/io/dagreader.go
+8
-3
@@ -18,7 +18,7 @@ type DagReader struct {
18
serv mdag.DAGService
19
node *mdag.Node
20
position int
21
- buf *bytes.Buffer
21
+ buf io.Reader
22
}
23
24
// NewDagReader creates a new reader object that reads the data represented by the given
@@ -71,8 +71,13 @@ func (dr *DagReader) precalcNextBuf() error {
71
return ft.ErrInvalidDirLocation
72
case ftpb.Data_File:
73
//TODO: this *should* work, needs testing first
74
- //return NewDagReader(nxt, dr.serv)
75
- panic("Not yet handling different layers of indirection!")
74
+ log.Warning("Running untested code for multilayered indirect FS reads.")
75
+ subr, err := NewDagReader(nxt, dr.serv)
76
+ if err != nil {
77
+ return err
78
+ }
79
+ dr.buf = subr
80
+ return nil
81
case ftpb.Data_Raw:
82
dr.buf = bytes.NewBuffer(pb.GetData())
83
return nil