revert "revert log debug information for sensor threshold assert events"

Add back the orignial submit 9bf6804c2d76b92005ad9851cb052d407ea3117f
and includes the fix the bug that crashed ipmbsensor.

log debug information for sensor threshold assert events

There are sightings that TCPUx_P12_PVCCIO_VS_Temp Sensor
reports reading of zero and trips the low critical threshold.
Add debug prints to gather data.

Also add logs for raw value in sensor base class to help
debug threshold assert events for other sensor type.

Tested:
Verified that log messages show up as expected for threshold
assert events. There is no unwanted log messages on systems that
do not have bad sensor readings.
Verified system stayed up for 30 minutes without crashing.

Signed-off-by: Zhikui Ren <zhikui.ren@intel.com>
Change-Id: I73e00e24bbae463dbe0f34e2308ee934588028d1
diff --git a/src/IpmbSensor.cpp b/src/IpmbSensor.cpp
index bc9d842..a7c1e09 100644
--- a/src/IpmbSensor.cpp
+++ b/src/IpmbSensor.cpp
@@ -241,7 +241,6 @@
                 return false;
             }
             resp = data[0];
-
             return true;
         }
         case (ReadingFormat::byte3):
@@ -348,6 +347,18 @@
                     read();
                     return;
                 }
+                else
+                {
+                    // rawValue only used in debug logging
+                    // up to 5th byte in data are used to derive value
+                    size_t end = std::min(sizeof(uint64_t), data.size());
+                    uint64_t rawData = 0;
+                    for (size_t i = 0; i < end; i++)
+                    {
+                        reinterpret_cast<uint8_t*>(&rawData)[i] = data[i];
+                    }
+                    rawValue = static_cast<double>(rawData);
+                }
 
                 /* Adjust value as per scale and offset */
                 value = (value * scaleVal) + offsetVal;