Use stdlib log pkg
Change-Id: I3029724dfe86ea4c54fbb84f413aa08a8b3046c2
diff --git a/omci_defs.go b/omci_defs.go
index 634d1d3..3062c4a 100644
--- a/omci_defs.go
+++ b/omci_defs.go
@@ -19,8 +19,7 @@
"bytes"
"encoding/binary"
"errors"
-
- logger "github.com/sirupsen/logrus"
+ "log"
)
//
@@ -88,10 +87,10 @@
r := bytes.NewReader(pkt)
if err := binary.Read(r, binary.BigEndian, &m); err != nil {
- logger.Error("binary.Read failed: %s", err)
+ log.Printf("binary.Read failed: %s", err)
return 0, 0, 0, 0, 0, OmciContent{}, errors.New("binary.Read failed")
}
- logger.Debug("OmciRun - TransactionId: %d MessageType: %d, ME Class: %d, ME Instance: %d, Content: %x",
+ log.Printf("OmciRun - TransactionId: %d MessageType: %d, ME Class: %d, ME Instance: %d, Content: %x",
m.TransactionId, m.MessageType&0x0F, m.MessageId.Class, m.MessageId.Instance, m.Content)
return m.TransactionId, m.DeviceId, m.MessageType & 0x0F, m.MessageId.Class, m.MessageId.Instance, m.Content, nil
}
diff --git a/omci_handlers.go b/omci_handlers.go
index e7e1d68..ef4413a 100644
--- a/omci_handlers.go
+++ b/omci_handlers.go
@@ -19,8 +19,7 @@
import (
"encoding/binary"
"errors"
-
- logger "github.com/sirupsen/logrus"
+ "log"
)
type OmciMsgHandler func(class OmciClass, content OmciContent, key OnuKey) ([]byte, error)
@@ -38,7 +37,7 @@
func mibReset(class OmciClass, content OmciContent, key OnuKey) ([]byte, error) {
var pkt []byte
- logger.Debug("Omci MibReset")
+ log.Printf("Omci MibReset")
pkt = []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
@@ -53,7 +52,7 @@
func mibUpload(class OmciClass, content OmciContent, key OnuKey) ([]byte, error) {
var pkt []byte
- logger.Debug("Omci MibUpload")
+ log.Printf("Omci MibUpload")
pkt = []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
@@ -73,7 +72,7 @@
state := OnuOmciStateMap[key]
- logger.Debug("Omci MibUploadNext %d", state.mibUploadCtr)
+ log.Printf("Omci MibUploadNext %d", state.mibUploadCtr)
switch state.mibUploadCtr {
case 0:
@@ -200,7 +199,7 @@
pkt[11] = state.uniGInstance // UNI-G ME Instance
state.uniGInstance++
default:
- logger.Error("Invalid MibUpload request %d", state.mibUploadCtr)
+ log.Printf("Invalid MibUpload request %d", state.mibUploadCtr)
return nil, errors.New("Invalid MibUpload request")
}
@@ -219,7 +218,7 @@
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
- logger.Debug("Omci Set")
+ log.Printf("Omci Set")
return pkt, nil
}
@@ -229,11 +228,11 @@
if class == GEMPortNetworkCTP {
if onuOmciState, ok := OnuOmciStateMap[key]; !ok {
- logger.Error("ONU Key Error - IntfId: %d, OnuId:", key.IntfId, key.OnuId)
+ log.Printf("ONU Key Error - IntfId: %d, OnuId:", key.IntfId, key.OnuId)
return nil, errors.New("ONU Key Error")
} else {
onuOmciState.gemPortId = binary.BigEndian.Uint16(content[:2])
- logger.Debug("Gem Port Id %d", onuOmciState.gemPortId)
+ log.Printf("Gem Port Id %d", onuOmciState.gemPortId)
// FIXME
OnuOmciStateMap[key].state = DONE
}
@@ -247,7 +246,7 @@
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
- logger.Debug("Omci Create")
+ log.Printf("Omci Create")
return pkt, nil
}
@@ -263,7 +262,7 @@
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
- logger.Debug("Omci Get")
+ log.Printf("Omci Get")
return pkt, nil
}
@@ -279,7 +278,7 @@
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
- logger.Debug("Omci GetAllAlarms")
+ log.Printf("Omci GetAllAlarms")
return pkt, nil
}
diff --git a/omci_sim.go b/omci_sim.go
index 8c5a12a..a428cb7 100644
--- a/omci_sim.go
+++ b/omci_sim.go
@@ -16,9 +16,7 @@
package core
-import (
- logger "github.com/sirupsen/logrus"
-)
+import "log"
func OmciSim(intfId uint32, onuId uint32, request []byte) ([]byte, error) {
var resp []byte
@@ -28,7 +26,7 @@
return resp, &OmciError{"Cannot parse omci msg"}
}
- logger.Debug("OmciRun - transactionId: %d msgType: %d, ME Class: %d, ME Instance: %d",
+ log.Printf("OmciRun - transactionId: %d msgType: %d, ME Class: %d, ME Instance: %d",
transactionId, msgType, class, instance)
key := OnuKey{intfId, onuId}
@@ -37,7 +35,7 @@
}
if _, ok := Handlers[msgType]; !ok {
- logger.Warn("Ignore omci msg (msgType %d not handled)", msgType)
+ log.Printf("Ignore omci msg (msgType %d not handled)", msgType)
return resp, &OmciError{"Unimplemented omci msg"}
}