Cleanup logging output

This commit is contained in:
2022-10-03 14:39:09 +02:00
parent 16c7a930c2
commit 1c2067286e
2 changed files with 14 additions and 8 deletions

View File

@@ -1,5 +1,8 @@
#include <boost/log/attributes/named_scope.hpp>
#include <iostream>
#include <boost/log/trivial.hpp>
#include <fan/FanCurve.h>
using namespace std;
@@ -8,7 +11,6 @@ FanCurve::FanCurve(std::vector<FanStep> steps,
std::vector<std::shared_ptr<Sensor>> sensors,
std::vector<std::shared_ptr<Fan>> fans)
: mSteps(steps), mTempSensors(sensors), mFans(fans) {
cout << "Initialized Fan Curve:" << endl;
PrintInfo();
}
@@ -52,28 +54,32 @@ int FanCurve::AggregateTemperature() {
}
void FanCurve::PrintInfo() {
BOOST_LOG_FUNCTION()
BOOST_LOG_TRIVIAL(info) << "### Fan curve:";
stringstream sStream;
cout << "Steps: ";
sStream << "Steps: ";
for (auto s : mSteps) {
sStream << "[ " << s.Temp << "C, " << s.Percent << "% ] ";
}
cout << sStream.str() << endl;
BOOST_LOG_TRIVIAL(info) << sStream.str();
sStream.str(string());
cout << "Sensors: ";
sStream << "Sensors: ";
for (auto s : mTempSensors) {
sStream << s->toString() << ", ";
}
cout << sStream.str() << endl;
BOOST_LOG_TRIVIAL(info) << sStream.str();
sStream.str(string());
cout << "Fans: ";
sStream << "Fans: ";
for (auto s : mFans) {
sStream << s->toString() << ", ";
}
cout << sStream.str() << endl;
BOOST_LOG_TRIVIAL(info) << sStream.str();
}