Improving logs
Change-Id: I75021b47851b3af946dc3a9b41a516934b4b2e3a
diff --git a/omci_common.go b/omci_common.go
index 223fe0e..55c3b02 100644
--- a/omci_common.go
+++ b/omci_common.go
@@ -18,7 +18,7 @@
import (
"fmt"
- "log"
+ log "github.com/sirupsen/logrus"
)
type OmciError struct {
@@ -38,7 +38,10 @@
}
func GetAttributes(class OmciClass, content OmciContent, key OnuKey, pkt []byte) []byte {
- log.Printf("GetAttributes() invoked with onu key: %+v\n", key)
+ log.WithFields(log.Fields{
+ "IntfId": key.IntfId,
+ "OnuId": key.OnuId,
+ }).Tracef("GetAttributes() invoked")
switch class {
case ANIG:
@@ -53,7 +56,11 @@
default:
// For unimplemented MEs, just fill in the attribute mask and return 0 values for the requested attributes
// TODO implement Get for unimplemented MEs as well
- log.Printf("Unimplemeted GetAttributes for ME Class: %v " +
+ log.WithFields(log.Fields{
+ "IntfId": key.IntfId,
+ "OnuId": key.OnuId,
+ "class": class,
+ }).Warnf("Unimplemeted GetAttributes for ME Class: %v " +
"Filling with zero value for the requested attributes", class)
AttributesMask := getAttributeMask(content)
pkt[8] = 0x00 // Command Processed Successfully
@@ -66,6 +73,9 @@
func getAttributeMask(content OmciContent) int {
// mask is present in pkt[8] and pkt[9]
- log.Printf("GetAttributeMask() invoked\n content[0] , content[1]: %+v, %+v", content[0], content[1])
+ log.WithFields(log.Fields{
+ "content[0]": content[0],
+ "content[1]": content[1],
+ }).Tracef("GetAttributeMask() invoked")
return (int(content[0]) << 8) | int(content[1])
}