Commit ae0386cf authored by Juan Batiz-Benet's avatar Juan Batiz-Benet
Browse files

user friendliness in logs + output

parent 44fe2f07
...@@ -293,7 +293,7 @@ func (s *Swarm) dial(ctx context.Context, p peer.ID) (*Conn, error) { ...@@ -293,7 +293,7 @@ func (s *Swarm) dial(ctx context.Context, p peer.ID) (*Conn, error) {
// ok try to setup the new connection. // ok try to setup the new connection.
swarmC, err := dialConnSetup(ctx, s, connC) swarmC, err := dialConnSetup(ctx, s, connC)
if err != nil { if err != nil {
log.Error("Dial newConnSetup failed. disconnecting.") log.Debug("Dial newConnSetup failed. disconnecting.")
log.Event(ctx, "dialFailureDisconnect", lgbl.NetConn(connC), lgbl.Error(err)) log.Event(ctx, "dialFailureDisconnect", lgbl.NetConn(connC), lgbl.Error(err))
connC.Close() // close the connection. didn't work out :( connC.Close() // close the connection. didn't work out :(
return nil, err return nil, err
...@@ -398,7 +398,7 @@ func dialConnSetup(ctx context.Context, s *Swarm, connC conn.Conn) (*Conn, error ...@@ -398,7 +398,7 @@ func dialConnSetup(ctx context.Context, s *Swarm, connC conn.Conn) (*Conn, error
// ok try to setup the new connection. (newConnSetup will add to group) // ok try to setup the new connection. (newConnSetup will add to group)
swarmC, err := s.newConnSetup(ctx, psC) swarmC, err := s.newConnSetup(ctx, psC)
if err != nil { if err != nil {
log.Error("Dial newConnSetup failed. disconnecting.") log.Debug("Dial newConnSetup failed. disconnecting.")
log.Event(ctx, "dialFailureDisconnect", lgbl.NetConn(connC), lgbl.Error(err)) log.Event(ctx, "dialFailureDisconnect", lgbl.NetConn(connC), lgbl.Error(err))
psC.Close() // we need to make sure psC is Closed. psC.Close() // we need to make sure psC is Closed.
return nil, err return nil, err
......
...@@ -79,7 +79,7 @@ func (ids *IDService) IdentifyConn(c inet.Conn) { ...@@ -79,7 +79,7 @@ func (ids *IDService) IdentifyConn(c inet.Conn) {
// ok give the response to our handler. // ok give the response to our handler.
if err := protocol.WriteHeader(s, ID); err != nil { if err := protocol.WriteHeader(s, ID); err != nil {
log.Error("error writing stream header for %s", ID) log.Debugf("error writing stream header for %s", ID)
log.Event(context.TODO(), "IdentifyOpenFailed", c.RemotePeer()) log.Event(context.TODO(), "IdentifyOpenFailed", c.RemotePeer())
} }
ids.ResponseHandler(s) ids.ResponseHandler(s)
...@@ -118,7 +118,7 @@ func (ids *IDService) ResponseHandler(s inet.Stream) { ...@@ -118,7 +118,7 @@ func (ids *IDService) ResponseHandler(s inet.Stream) {
r := ggio.NewDelimitedReader(s, 2048) r := ggio.NewDelimitedReader(s, 2048)
mes := pb.Identify{} mes := pb.Identify{}
if err := r.ReadMsg(&mes); err != nil { if err := r.ReadMsg(&mes); err != nil {
log.Errorf("%s error receiving message from %s %s %s", ID, log.Debugf("%s error receiving message from %s %s %s", ID,
c.RemotePeer(), c.RemoteMultiaddr(), err) c.RemotePeer(), c.RemoteMultiaddr(), err)
return return
} }
...@@ -169,7 +169,7 @@ func (ids *IDService) consumeMessage(mes *pb.Identify, c inet.Conn) { ...@@ -169,7 +169,7 @@ func (ids *IDService) consumeMessage(mes *pb.Identify, c inet.Conn) {
for _, addr := range laddrs { for _, addr := range laddrs {
maddr, err := ma.NewMultiaddrBytes(addr) maddr, err := ma.NewMultiaddrBytes(addr)
if err != nil { if err != nil {
log.Errorf("%s failed to parse multiaddr from %s %s", ID, log.Debugf("%s failed to parse multiaddr from %s %s", ID,
p, c.RemoteMultiaddr()) p, c.RemoteMultiaddr())
continue continue
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment