@cryptotaxi247 / kubo / commits / 76d9d89af

user friendliness in logs + output

Juan Batiz-Benet committed Jan 24, 2015 at 16:22 UTC 76d9d89aff230895dd3bb1171085eb85633fcbc3
9 files changed +15 -15
cmd/ipfs/daemon.go
+1
@@ -49,6 +49,7 @@ the daemon.
49
50 func daemonFunc(req cmds.Request, res cmds.Response) {
51
52 + fmt.Println("Initializing daemon...")
53 // first, whether user has provided the initialization flag. we may be
54 // running in an uninitialized state.
55 initialize, _, err := req.Option(initOptionKwd).Bool()
cmd/ipfs/init.go
-1
@@ -80,7 +80,6 @@ var welcomeMsg = `Hello and Welcome to IPFS!
80 If you're seeing this, you have successfully installed
81 IPFS and are now interfacing with the ipfs merkledag!
82
83 -For a short demo of what you can do, enter 'ipfs tour'
83 `
84
85 func initWithDefaults(repoRoot string) error {
core/bootstrap.go
+2 -2
@@ -92,7 +92,7 @@ func Bootstrap(n *IpfsNode, cfg BootstrapConfig) (io.Closer, error) {
92
93 if err := bootstrapRound(ctx, n.PeerHost, thedht, n.Peerstore, cfg); err != nil {
94 log.Event(ctx, "bootstrapError", n.Identity, lgbl.Error(err))
95 - log.Errorf("%s bootstrap error: %s", n.Identity, err)
95 + log.Debugf("%s bootstrap error: %s", n.Identity, err)
96 }
97 }
98
@@ -187,7 +187,7 @@ func bootstrapConnect(ctx context.Context,
187 err := route.Connect(ctx, p.ID)
188 if err != nil {
189 log.Event(ctx, "bootstrapDialFailed", p.ID)
190 - log.Errorf("failed to bootstrap with %v: %s", p.ID, err)
190 + log.Debugf("failed to bootstrap with %v: %s", p.ID, err)
191 errs <- err
192 return
193 }
core/core.go
+1 -1
@@ -308,7 +308,7 @@ func (n *IpfsNode) Bootstrap(cfg BootstrapConfig) error {
308 bpeers := n.Repo.Config().Bootstrap
309 ps, err := toPeerInfos(bpeers)
310 if err != nil {
311 - log.Error("failed to parse bootstrap peers from config: %s", bpeers)
311 + log.Warningf("failed to parse bootstrap peers from config: %s", bpeers)
312 return nil
313 }
314 return ps
p2p/net/swarm/swarm_dial.go
+2 -2
@@ -293,7 +293,7 @@ func (s *Swarm) dial(ctx context.Context, p peer.ID) (*Conn, error) {
293 // ok try to setup the new connection.
294 swarmC, err := dialConnSetup(ctx, s, connC)
295 if err != nil {
296 - log.Error("Dial newConnSetup failed. disconnecting.")
296 + log.Debug("Dial newConnSetup failed. disconnecting.")
297 log.Event(ctx, "dialFailureDisconnect", lgbl.NetConn(connC), lgbl.Error(err))
298 connC.Close() // close the connection. didn't work out :(
299 return nil, err
@@ -398,7 +398,7 @@ func dialConnSetup(ctx context.Context, s *Swarm, connC conn.Conn) (*Conn, error
398 // ok try to setup the new connection. (newConnSetup will add to group)
399 swarmC, err := s.newConnSetup(ctx, psC)
400 if err != nil {
401 - log.Error("Dial newConnSetup failed. disconnecting.")
401 + log.Debug("Dial newConnSetup failed. disconnecting.")
402 log.Event(ctx, "dialFailureDisconnect", lgbl.NetConn(connC), lgbl.Error(err))
403 psC.Close() // we need to make sure psC is Closed.
404 return nil, err
p2p/protocol/identify/id.go
+3 -3
@@ -79,7 +79,7 @@ func (ids *IDService) IdentifyConn(c inet.Conn) {
79
80 // ok give the response to our handler.
81 if err := protocol.WriteHeader(s, ID); err != nil {
82 - log.Error("error writing stream header for %s", ID)
82 + log.Debugf("error writing stream header for %s", ID)
83 log.Event(context.TODO(), "IdentifyOpenFailed", c.RemotePeer())
84 }
85 ids.ResponseHandler(s)
@@ -118,7 +118,7 @@ func (ids *IDService) ResponseHandler(s inet.Stream) {
118 r := ggio.NewDelimitedReader(s, 2048)
119 mes := pb.Identify{}
120 if err := r.ReadMsg(&mes); err != nil {
121 - log.Errorf("%s error receiving message from %s %s %s", ID,
121 + log.Debugf("%s error receiving message from %s %s %s", ID,
122 c.RemotePeer(), c.RemoteMultiaddr(), err)
123 return
124 }
@@ -169,7 +169,7 @@ func (ids *IDService) consumeMessage(mes *pb.Identify, c inet.Conn) {
169 for _, addr := range laddrs {
170 maddr, err := ma.NewMultiaddrBytes(addr)
171 if err != nil {
172 - log.Errorf("%s failed to parse multiaddr from %s %s", ID,
172 + log.Debugf("%s failed to parse multiaddr from %s %s", ID,
173 p, c.RemoteMultiaddr())
174 continue
175 }
test/sharness/t0020-init.sh
+1 -1
@@ -34,7 +34,7 @@ test_expect_success "ipfs peer id looks good" '
34 '
35
36 test_expect_success "ipfs init output looks good" '
37 - STARTHASH="QmYpv2VEsxzTTXRYX3PjDg961cnJE3kY1YDXLycHGQ3zZB" &&
37 + STARTHASH="QmTTFXiXoixwT53tcGPu419udsHEHYu6AHrQC8HAKdJYaZ" &&
38 echo "initializing ipfs node at $IPFS_PATH" >expected &&
39 echo "generating 4096-bit RSA keypair...done" >>expected &&
40 echo "peer identity: $PEERID" >>expected &&
test/sharness/t0060-daemon.sh
+1 -1
@@ -34,7 +34,7 @@ test_expect_success "ipfs peer id looks good" '
34
35 # note this is almost the same as t0020-init.sh "ipfs init output looks good"
36 test_expect_success "ipfs daemon output looks good" '
37 - STARTHASH="QmYpv2VEsxzTTXRYX3PjDg961cnJE3kY1YDXLycHGQ3zZB" &&
37 + STARTHASH="QmTTFXiXoixwT53tcGPu419udsHEHYu6AHrQC8HAKdJYaZ" &&
38 echo "initializing ipfs node at $IPFS_PATH" >expected &&
39 echo "generating key pair...done" >>expected &&
40 echo "peer identity: $PEERID" >>expected &&
test/sharness/t0080-repo.sh
+4 -4
@@ -43,7 +43,7 @@ test_expect_success "'ipfs pin rm' succeeds" '
43
44 test_expect_success "file no longer pinned" '
45 # we expect the welcome file to show up here
46 - echo QmYpv2VEsxzTTXRYX3PjDg961cnJE3kY1YDXLycHGQ3zZB > expected2
46 + echo QmTTFXiXoixwT53tcGPu419udsHEHYu6AHrQC8HAKdJYaZ > expected2
47 ipfs pin ls -type=recursive > actual2
48 test_cmp expected2 actual2
49 '
@@ -84,8 +84,8 @@ test_expect_success "'ipfs repo gc' removes file" '
84 '
85
86 test_expect_success "'ipfs refs local' no longer shows file" '
87 - echo QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn > expected8
88 - echo QmYpv2VEsxzTTXRYX3PjDg961cnJE3kY1YDXLycHGQ3zZB >> expected8
87 + echo QmTTFXiXoixwT53tcGPu419udsHEHYu6AHrQC8HAKdJYaZ > expected8
88 + echo QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn >> expected8
89 ipfs refs local > actual8
90 test_cmp expected8 actual8
91 '
@@ -123,7 +123,7 @@ test_expect_success "'ipfs pin ls -type=direct' is correct" '
123
124 test_expect_success "'ipfs pin ls -type=recursive' is correct" '
125 echo $MBLOCKHASH > rp_expected
126 - echo QmYpv2VEsxzTTXRYX3PjDg961cnJE3kY1YDXLycHGQ3zZB >> rp_expected
126 + echo QmTTFXiXoixwT53tcGPu419udsHEHYu6AHrQC8HAKdJYaZ >> rp_expected
127 cat rp_expected | sort > rp_exp_sorted
128 ipfs pin ls -type=recursive | sort > rp_actual
129 test_cmp rp_exp_sorted rp_actual