Tweaks to logging

This commit is contained in:
Paul Lorenz
2021-12-01 13:53:52 -05:00
parent 469bb9ee79
commit f19cf0ce09
3 changed files with 12 additions and 9 deletions
+1 -1
View File
@@ -92,7 +92,7 @@ func (self *Scanner) scan() {
if err == nil {
msg := channel2.NewMessage(ctrl_msg.CircuitConfirmationType, body)
if err := self.ctrl.Send(msg); err == nil {
logrus.Warnf("sent confirmation for [%d] circuits", len(idleCircuitIds))
logrus.WithField("circuitCount", len(idleCircuitIds)).Warnf("sent confirmation for circuits")
} else {
logrus.Errorf("error sending confirmation request (%v)", err)
}
+7 -4
View File
@@ -51,19 +51,22 @@ func (self *closeHandler) HandleClose(ch channel2.Channel) {
}
}()
log := pfxlog.ContextLogger(ch.Label())
log := pfxlog.ContextLogger(ch.Label()).
WithField("linkId", self.link.Id()).
WithField("routerId", self.link.DestinationId())
log.Info("link closed")
fault := &ctrl_pb.Fault{Subject: ctrl_pb.FaultSubject_LinkFault, Id: self.link.Id().Token}
if body, err := proto.Marshal(fault); err == nil {
msg := channel2.NewMessage(int32(ctrl_pb.ContentType_FaultType), body)
if err := self.ctrl.Channel().Send(msg); err == nil {
log.Error("transmitted link fault")
log.Debug("transmitted link fault")
} else {
log.Errorf("unexpected error transmitting link fault (%v)", err)
log.WithError(err).Error("unexpected error transmitting link fault")
}
} else {
log.Errorf("unexpected error (%v)", err)
log.WithError(err).Error("unexpected error")
}
self.forwarder.UnregisterLink(self.link)
+4 -4
View File
@@ -53,7 +53,7 @@ func (self *dialer) Dial(addressString string, linkId *identity.TokenId, routerI
}
func (self *dialer) dialSplit(linkId *identity.TokenId, address transport.Address, routerId, connId string) (xlink.Xlink, error) {
logrus.Infof("dialing link with split payload/ack channels [l/%s]", linkId.Token)
logrus.Debugf("dialing link with split payload/ack channels [l/%s]", linkId.Token)
payloadDialer := channel2.NewClassicDialer(linkId, address, map[int32][]byte{
LinkHeaderRouterId: []byte(routerId),
@@ -61,7 +61,7 @@ func (self *dialer) dialSplit(linkId *identity.TokenId, address transport.Addres
LinkHeaderType: {PayloadChannel},
})
logrus.Infof("dialing payload channel for [l/%s]", linkId.Token)
logrus.Debugf("dialing payload channel for [l/%s]", linkId.Token)
payloadCh, err := channel2.NewChannelWithTransportConfiguration("l/"+linkId.Token, payloadDialer, self.config.options, self.tcfg)
if err != nil {
@@ -73,7 +73,7 @@ func (self *dialer) dialSplit(linkId *identity.TokenId, address transport.Addres
LinkHeaderType: {AckChannel},
})
logrus.Infof("dialing ack channel for [l/%s]", linkId.Token)
logrus.Debugf("dialing ack channel for [l/%s]", linkId.Token)
ackCh, err := channel2.NewChannelWithTransportConfiguration("l/"+linkId.Token, ackDialer, self.config.options, self.tcfg)
if err != nil {
@@ -98,7 +98,7 @@ func (self *dialer) dialSplit(linkId *identity.TokenId, address transport.Addres
}
func (self *dialer) dialSingle(linkId *identity.TokenId, address transport.Address, routerId, connId string) (xlink.Xlink, error) {
logrus.Infof("dialing link with single channel [l/%s]", linkId.Token)
logrus.Debugf("dialing link with single channel [l/%s]", linkId.Token)
payloadDialer := channel2.NewClassicDialer(linkId, address, map[int32][]byte{
LinkHeaderRouterId: []byte(routerId),