sdr: Convert std::cerr to lg2
Change-Id: Ided5ac23f9b5a93e09928b324a5fc95ba689e874
Signed-off-by: Haicheng Zhang <zhanghch05@ieisystem.com>
diff --git a/dbus-sdr/sensorcommands.cpp b/dbus-sdr/sensorcommands.cpp
index 9f33dcd..90e2ebf 100644
--- a/dbus-sdr/sensorcommands.cpp
+++ b/dbus-sdr/sensorcommands.cpp
@@ -38,7 +38,6 @@
#include <cmath>
#include <cstring>
#include <format>
-#include <iostream>
#include <map>
#include <optional>
#include <stdexcept>
@@ -592,8 +591,9 @@
}
if constexpr (debug)
{
- std::cerr << "VR sensor " << sensor::parseSdrIdFromPath(path)
- << " mode is: [" << index << "] " << mode << std::endl;
+ lg2::error("VR sensor {PATH} mode is: [{INDEX}] {MODE}", "PATH",
+ sensor::parseSdrIdFromPath(path), "INDEX", index, "MODE",
+ mode);
}
return true;
}
@@ -1032,15 +1032,14 @@
{
// This is the first reading, show the coefficients
double step = (max - min) / 255.0;
- std::cerr
- << "IPMI sensor "
- << details::sdrStatsTable.getName((ctx->lun << 8) | sensnum)
- << ": Range min=" << min << " max=" << max << ", step=" << step
- << ", Coefficients mValue=" << static_cast<int>(mValue)
- << " rExp=" << static_cast<int>(rExp)
- << " bValue=" << static_cast<int>(bValue)
- << " bExp=" << static_cast<int>(bExp)
- << " bSigned=" << static_cast<int>(bSigned) << "\n";
+ lg2::error(
+ "IPMI sensor {NAME}: Range min={MIN} max={MAX}, step={STEP}, "
+ "Coefficients mValue={MVALUE} rExp={REXP} bValue={BVALUE} "
+ "bExp={BEXP} bSigned={BSIGNED}",
+ "NAME",
+ details::sdrStatsTable.getName((ctx->lun << 8) | sensnum),
+ "MIN", min, "MAX", max, "STEP", step, "MVALUE", mValue, "REXP",
+ rExp, "BVALUE", bValue, "BEXP", bExp, "BSIGNED", bSigned);
}
}