@@ -34,9 +34,9 @@ void ProgressReporter::unregisterProgressIndicator(const boost::shared_ptr<Progr
3434
3535void ProgressReporter::unregisterAllProgressIndicators () { indicators_.clear (); }
3636
37- void ProgressReporter::updateProgress (const unsigned long progress, const unsigned long total) {
37+ void ProgressReporter::updateProgress (const unsigned long progress, const unsigned long total, const std::string& detail ) {
3838 for (const auto & i : indicators_)
39- i->updateProgress (progress, total);
39+ i->updateProgress (progress, total, detail );
4040}
4141
4242void ProgressReporter::resetProgress () {
@@ -46,32 +46,32 @@ void ProgressReporter::resetProgress() {
4646
4747SimpleProgressBar::SimpleProgressBar (const std::string& message, const QuantLib::Size messageWidth,
4848 const QuantLib::Size barWidth, const QuantLib::Size numberOfScreenUpdates)
49- : message_ (message), messageWidth_(messageWidth), barWidth_(barWidth),
49+ : key_ (message), messageWidth_(messageWidth), barWidth_(barWidth),
5050 numberOfScreenUpdates_ (numberOfScreenUpdates), updateCounter_(0 ), finalized_(false ) {
51- updateProgress (0 , 1 );
51+ updateProgress (0 , 1 , " " );
5252 updateCounter_--;
5353}
5454
55- void SimpleProgressBar::updateProgress (const unsigned long progress, const unsigned long total) {
55+ void SimpleProgressBar::updateProgress (const unsigned long progress, const unsigned long total, const std::string& detail ) {
5656 if (!ConsoleLog::instance ().enabled ())
5757 return ;
5858 if (finalized_)
5959 return ;
6060 double ratio = static_cast <double >(progress) / static_cast <double >(total);
6161 if (progress >= total) {
62- std::cout << " \r " << std::setw (messageWidth_) << std::left << message_ ;
62+ std::cout << " \r " << std::setw (messageWidth_) << std::left << key_ ;
6363 for (unsigned int i = 0 ; i < barWidth_; ++i)
6464 std::cout << " " ;
6565 std::cout << " \r " ;
66- std::cout << std::setw (messageWidth_) << std::left << message_ ;
66+ std::cout << std::setw (messageWidth_) << std::left << key_ ;
6767 std::cout.flush ();
6868 finalized_ = true ;
6969 return ;
7070 }
7171 if (updateCounter_ > 0 && progress * numberOfScreenUpdates_ < updateCounter_ * total) {
7272 return ;
7373 }
74- std::cout << " \r " << std::setw (messageWidth_) << std::left << message_ ;
74+ std::cout << " \r " << std::setw (messageWidth_) << std::left << key_ ;
7575 if (barWidth_ > 0 )
7676 std::cout << " [" ;
7777 unsigned int pos = static_cast <unsigned int >(static_cast <double >(barWidth_) * ratio);
@@ -96,16 +96,16 @@ void SimpleProgressBar::reset() {
9696}
9797
9898ProgressLog::ProgressLog (const std::string& message, const unsigned int numberOfMessages, const oreSeverity logLevel)
99- : message_ (message), numberOfMessages_(numberOfMessages), logLevel_(logLevel), messageCounter_(0 ) {}
99+ : key_ (message), numberOfMessages_(numberOfMessages), logLevel_(logLevel), messageCounter_(0 ) {}
100100
101- void ProgressLog::updateProgress (const unsigned long progress, const unsigned long total) {
101+ void ProgressLog::updateProgress (const unsigned long progress, const unsigned long total, const std::string& detail ) {
102102 if (messageCounter_ > 0 && progress * numberOfMessages_ < (messageCounter_ * total)) {
103103 return ;
104104 }
105- MLOG (logLevel_, message_ << " " << progress << " out of " << total << " steps ("
105+ MLOG (logLevel_, key_ << " ( " << detail << " ): " << progress << " out of " << total << " steps ("
106106 << static_cast <int >(static_cast <double >(progress) / static_cast <double >(total) * 100.0 )
107107 << " %) completed" );
108- ProgressMessage (message_ , progress, total).log ();
108+ ProgressMessage (key_ , progress, total, detail ).log ();
109109 messageCounter_++;
110110}
111111
@@ -115,7 +115,7 @@ MultiThreadedProgressIndicator::MultiThreadedProgressIndicator(
115115 const std::set<boost::shared_ptr<ProgressIndicator>>& indicators)
116116 : indicators_(indicators) {}
117117
118- void MultiThreadedProgressIndicator::updateProgress (const unsigned long progress, const unsigned long total) {
118+ void MultiThreadedProgressIndicator::updateProgress (const unsigned long progress, const unsigned long total, const std::string& detail ) {
119119 boost::unique_lock<boost::shared_mutex> lock (mutex_);
120120 threadData_[std::this_thread::get_id ()] = std::make_pair (progress, total);
121121 unsigned long progressTmp = 0 ;
@@ -125,7 +125,7 @@ void MultiThreadedProgressIndicator::updateProgress(const unsigned long progress
125125 totalTmp += d.second .second ;
126126 }
127127 for (auto & i : indicators_)
128- i->updateProgress (progressTmp, totalTmp);
128+ i->updateProgress (progressTmp, totalTmp, detail );
129129}
130130
131131void MultiThreadedProgressIndicator::reset () {
0 commit comments