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

View File

@@ -36,7 +36,7 @@ PWMControl::PWMControl(string controlPath) : mControlPath(controlPath) {
} }
PWMControl::~PWMControl() { PWMControl::~PWMControl() {
cout << "Cleanup" << endl; BOOST_LOG_TRIVIAL(trace) << "Cleanup";
Reset(); Reset();
} }