Merge "Adding detailed fields to kafka logs"
diff --git a/internal/bbsim/responders/igmp/igmp.go b/internal/bbsim/responders/igmp/igmp.go
index 75f2759..defbe19 100644
--- a/internal/bbsim/responders/igmp/igmp.go
+++ b/internal/bbsim/responders/igmp/igmp.go
@@ -167,7 +167,12 @@
}
//Sending IGMP packets
if err := stream.Send(&openolt.Indication{Data: data}); err != nil {
- log.Errorf("Fail to send IGMP PktInd indication for ONU: %s, IntfId: %s, SerialNumber: %s, error: %v", onuId, ponPortId, serialNumber, err)
+ log.WithFields(log.Fields{
+ "OnuId": onuId,
+ "IntfId": ponPortId,
+ "SerialNumber": serialNumber,
+ "err": err,
+ }).Errorf("Fail to send IGMP PktInd indication")
return err
}
return nil
diff --git a/internal/common/kafka_utils.go b/internal/common/kafka_utils.go
index 9ddd79c..e907aad 100644
--- a/internal/common/kafka_utils.go
+++ b/internal/common/kafka_utils.go
@@ -62,7 +62,15 @@
for {
select {
case event := <-eventChannel:
- log.Debugf("Received event on channel %v", event)
+ log.WithFields(log.Fields{
+ "EventType": event.EventType,
+ "OnuSerial": event.OnuSerial,
+ "OltID": event.OltID,
+ "IntfID": event.IntfID,
+ "OnuID": event.OnuID,
+ "EpochTime": event.EpochTime,
+ "Timestamp": event.Timestamp,
+ }).Trace("Received event on channel")
jsonEvent, err := json.Marshal(event)
if err != nil {
log.Errorf("Failed to get json event %v", err)
@@ -72,7 +80,15 @@
Topic: topic,
Value: sarama.ByteEncoder(jsonEvent),
}
- log.Debugf("Event sent on kafka")
+ log.WithFields(log.Fields{
+ "EventType": event.EventType,
+ "OnuSerial": event.OnuSerial,
+ "OltID": event.OltID,
+ "IntfID": event.IntfID,
+ "OnuID": event.OnuID,
+ "EpochTime": event.EpochTime,
+ "Timestamp": event.Timestamp,
+ }).Debug("Event sent on kafka")
}
}
}