Improved logging of SLA support tree creation.

This commit is contained in:
tamasmeszaros 2019-07-30 17:55:22 +02:00
parent 57008d0d77
commit ca1f3dc6af
2 changed files with 23 additions and 10 deletions

View file

@ -928,12 +928,14 @@ void SLAPrint::process()
double d = ostepd * OBJ_STEP_LEVELS[slaposSupportTree] / 100.0; double d = ostepd * OBJ_STEP_LEVELS[slaposSupportTree] / 100.0;
double init = m_report_status.status(); double init = m_report_status.status();
ctl.statuscb = [this, d, init](unsigned st, const std::string&) ctl.statuscb = [this, d, init](unsigned st, const std::string &logmsg)
{ {
double current = init + st * d; double current = init + st * d;
if(std::round(m_report_status.status()) < std::round(current)) if(std::round(m_report_status.status()) < std::round(current))
m_report_status(*this, current, m_report_status(*this, current,
OBJ_STEP_LABELS(slaposSupportTree)); OBJ_STEP_LABELS(slaposSupportTree),
SlicingStatus::DEFAULT,
logmsg);
}; };
@ -1914,11 +1916,17 @@ std::string SLAPrintStatistics::finalize_output_path(const std::string &path_in)
return final_path; return final_path;
} }
void SLAPrint::StatusReporter::operator()( void SLAPrint::StatusReporter::operator()(SLAPrint & p,
SLAPrint &p, double st, const std::string &msg, unsigned flags) double st,
const std::string &msg,
unsigned flags,
const std::string &logmsg)
{ {
m_st = st; m_st = st;
BOOST_LOG_TRIVIAL(info) << st << "% " << msg << log_memory_info(); BOOST_LOG_TRIVIAL(info)
<< st << "% " << msg << (logmsg.empty() ? "" : ": ") << logmsg
<< log_memory_info();
p.set_status(int(std::round(st)), msg, flags); p.set_status(int(std::round(st)), msg, flags);
} }

View file

@ -447,16 +447,21 @@ private:
// Estimated print time, material consumed. // Estimated print time, material consumed.
SLAPrintStatistics m_print_statistics; SLAPrintStatistics m_print_statistics;
class StatusReporter { class StatusReporter
{
double m_st = 0; double m_st = 0;
public: public:
void operator() (SLAPrint& p, double st, const std::string& msg, void operator()(SLAPrint & p,
unsigned flags = SlicingStatus::DEFAULT); double st,
const std::string &msg,
unsigned flags = SlicingStatus::DEFAULT,
const std::string &logmsg = "");
double status() const { return m_st; } double status() const { return m_st; }
} m_report_status; } m_report_status;
friend SLAPrintObject; friend SLAPrintObject;
}; };