Fix log formatting discovered in 1.12 update
Change-Id: I22c2373d31ed42f1a1836e5a255fe483ef37d9f0
diff --git a/core/core_server.go b/core/core_server.go
index ce55024..ba49118 100644
--- a/core/core_server.go
+++ b/core/core_server.go
@@ -136,13 +136,13 @@
addressport := s.gRPCAddress + ":" + strconv.Itoa(int(s.gRPCPort))
listener, gserver, err := NewGrpcServer(addressport)
if err != nil {
- logger.Error("Failed to create gRPC server", err)
+ logger.Error("Failed to create gRPC server: %v", err)
return err
}
s.gRPCserver = gserver
openolt.RegisterOpenoltServer(gserver, s)
if err := gserver.Serve(listener); err != nil {
- logger.Error("Failed to run gRPC server", err)
+ logger.Error("Failed to run gRPC server: %v", err)
return err
}
s.wg.Wait()
@@ -287,19 +287,19 @@
s.wg.Add(1)
ioinfos, veths, err := createIoinfos(s.Olt.ID, s.Vethnames)
if err != nil {
- logger.Error("createIoinfos failed.", err)
+ logger.Error("createIoinfos failed: %v", err)
return err
}
s.Ioinfos = ioinfos
s.Vethnames = veths
- logger.Debug("Created vethnames:%v", s.Vethnames)
+ logger.Debug("Created vethnames: %v", s.Vethnames)
parent := ctx
child, cancel := context.WithCancel(parent)
s.cancel = cancel
if err = s.runPktLoops(child, stream); err != nil {
- logger.Error("runPktLoops failed.", err)
+ logger.Error("runPktLoops failed: %v", err)
return err
}
return nil
@@ -319,7 +319,7 @@
var handler *pcap.Handle
nniup, nnidw := makeNniName(oltid)
if handler, Vethnames, err = setupVethHandler(nniup, nnidw, Vethnames); err != nil {
- logger.Error("setupVethHandler failed for nni", err)
+ logger.Error("setupVethHandler failed for nni: %v", err)
return ioinfos, Vethnames, err
}
@@ -352,7 +352,7 @@
select {
case v, ok := <-errchOmci: // Wait for OmciInitialization
if ok { //Error
- logger.Error("Error happend in Omci:%s", v)
+ logger.Error("Error happend in Omci: %s", v)
return v
}
case <-child.Done():
@@ -427,7 +427,7 @@
logger.Debug("OLT %d send omci indication, IF %v (ONU-ID: %v) pkt:%x.", s.Olt.ID, msg.IntfId, msg.OnuId, msg.Pkt)
omci := &openolt.Indication_OmciInd{OmciInd: &msg}
if err := stream.Send(&openolt.Indication{Data: omci}); err != nil {
- logger.Error("send omci indication failed.", err)
+ logger.Error("send omci indication failed: %v", err)
continue
}
case msg := <- s.eapolIn:
@@ -439,11 +439,11 @@
continue
}
- logger.Debug("OLT %d send eapol packet in (upstream), IF %v (ONU-ID: %v) pkt:%x.", s.Olt.ID, intfid, onuid)
+ logger.Debug("OLT %d send eapol packet in (upstream), IF %v (ONU-ID: %v) pkt: %x", s.Olt.ID, intfid, onuid, msg.Byte)
data = &openolt.Indication_PktInd{PktInd: &openolt.PacketIndication{IntfType: "pon", IntfId: intfid, GemportId: gemid, Pkt: msg.Byte}}
if err := stream.Send(&openolt.Indication{Data: data}); err != nil {
- logger.Error("Fail to send EAPOL PktInd indication.", err)
+ logger.Error("Fail to send EAPOL PktInd indication. %v", err)
return err
}
case msg := <- s.dhcpIn: //TODO: We should put omciIn, eapolIn, dhcpIn toghether
@@ -480,12 +480,11 @@
}).Error("Could not find onuid in CtagMap", onuid, sn, s.CtagMap)
}
- logger.Debug("OLT %d send dhcp packet in (upstream), IF %v (ONU-ID: %v) pkt:%x.", s.Olt.ID, intfid, onuid)
- logger.Debug(pkt.Dump())
+ logger.Debug("OLT %d send dhcp packet in (upstream), IF %v (ONU-ID: %v) pkt: %x", s.Olt.ID, intfid, onuid, pkt.Dump())
data = &openolt.Indication_PktInd{PktInd: &openolt.PacketIndication{IntfType: "pon", IntfId: intfid, GemportId: gemid, Pkt: msg.Byte}}
if err := stream.Send(&openolt.Indication{Data: data}); err != nil {
- logger.Error("Fail to send DHCP PktInd indication.", err)
+ logger.Error("Fail to send DHCP PktInd indication: %v", err)
return err
}
@@ -504,7 +503,7 @@
pkt := nnipkt.Pkt
data = &openolt.Indication_PktInd{PktInd: &openolt.PacketIndication{IntfType: "nni", IntfId: intfid, Pkt: pkt.Data()}}
if err := stream.Send(&openolt.Indication{Data: data}); err != nil {
- logger.Error("Fail to send PktInd indication.", err)
+ logger.Error("Fail to send PktInd indication: %v", err)
return err
}
diff --git a/core/io_info.go b/core/io_info.go
index 7a272f4..e56d4b6 100644
--- a/core/io_info.go
+++ b/core/io_info.go
@@ -68,12 +68,12 @@
logger.Info("%s & %s was created.", veth1, veth2)
err = exec.Command("ip", "link", "set", veth1, "up").Run()
if err != nil {
- logger.Error("Fail to createVeth() veth1 up", err)
+ logger.Error("Fail to createVeth() veth1 up: %v", err)
return
}
err = exec.Command("ip", "link", "set", veth2, "up").Run()
if err != nil {
- logger.Error("Fail to createVeth() veth2 up", err)
+ logger.Error("Fail to createVeth() veth2 up: %v", err)
return
}
logger.Info("%s & %s was up.", veth1, veth2)
diff --git a/core/io_worker.go b/core/io_worker.go
index 4d885b6..0496b9c 100644
--- a/core/io_worker.go
+++ b/core/io_worker.go
@@ -46,10 +46,9 @@
func SendUni(handle *pcap.Handle, packet gopacket.Packet, onu *device.Onu) {
err := handle.WritePacketData(packet.Data())
if err != nil {
- utils.LoggerWithOnu(onu).Error("Error in send packet to UNI-IF: %v e:%s", *handle, err)
+ utils.LoggerWithOnu(onu).Errorf("Error in send packet to UNI-IF: %v e:%v", *handle, err)
}
- utils.LoggerWithOnu(onu).Debug("Successfully send packet to UNI-IF: %v ", *handle)
- //logger.Println(packet.Dump())
+ utils.LoggerWithOnu(onu).Debugf("Successfully send packet to UNI-IF: %v", *handle)
}
func SendNni(handle *pcap.Handle, packet gopacket.Packet) {
@@ -156,13 +155,13 @@
err1 := CreateVethPairs(inveth, outveth)
vethnames = append(vethnames, inveth)
if err1 != nil {
- logger.Error("setupVethHandler failed", err1)
+ logger.Error("setupVethHandler failed: %v", err1)
RemoveVeths(vethnames)
return nil, vethnames, err1
}
handler, err2 := getVethHandler(inveth)
if err2 != nil {
- logger.Error("getVethHandler failed", err2)
+ logger.Error("getVethHandler failed: %v", err2)
RemoveVeths(vethnames)
return nil, vethnames, err2
}
diff --git a/core/mediator.go b/core/mediator.go
index ce69452..5565715 100644
--- a/core/mediator.go
+++ b/core/mediator.go
@@ -174,7 +174,7 @@
}
func transitOnu (key device.Devkey, current device.DeviceState, next device.DeviceState, tm *TestManager, o *option) error {
- logger.Debug("trnsitOnu called with key:%s, current:%d , next:%d", key, current, next)
+ logger.Debug("trnsitOnu called with key: %v, current: %d, next: %d", key, current, next)
if current == device.ONU_ACTIVE && next == device.ONU_OMCIACTIVE {
t := tm.CreateTester(o, key)
if err := tm.StartTester(key, t); err != nil {