@@ -32,50 +32,58 @@ namespace geode
3232 class ConsoleProgressLoggerClient ::Impl
3333 {
3434 public:
35- void start ( absl::string_view message, index_t /* nb_steps */ )
35+ void start ( const std::string& message, index_t /* nb_steps */ )
3636 {
37- Logger::info ( message, " started" );
37+ message_ = message;
38+ Logger::info ( message_, " started" );
3839 }
3940
40- void update (
41- absl::string_view message, index_t current, index_t nb_steps )
41+ void update ( index_t current, index_t nb_steps )
4242 {
43- const auto percent = std::floor ( current / nb_steps * 100 );
43+ const auto percent =
44+ std::floor ( static_cast < double >( current ) / nb_steps * 100 );
4445 Logger::info (
45- message , " " , current, " /" , nb_steps, " (" , percent, " %)" );
46+ message_ , " " , current, " /" , nb_steps, " (" , percent, " %)" );
4647 }
4748
48- void end ( absl::string_view message, index_t current, index_t nb_steps )
49+ void completed ( )
4950 {
50- const auto status = current == nb_steps ? " completed" : " failed" ;
51- Logger::info ( message, " " , status, " in " , timer_.duration () );
51+ Logger::info ( message_, " completed in " , timer_.duration () );
52+ }
53+
54+ void failed ()
55+ {
56+ Logger::info ( message_, " failed in " , timer_.duration () );
5257 }
5358
5459 private:
5560 DEBUG_CONST Timer timer_;
61+ std::string message_;
5662 };
5763
58- ConsoleProgressLoggerClient::ConsoleProgressLoggerClient (
59- const std::string& message )
60- : ProgressLoggerClient{ message }
61- {
62- }
64+ ConsoleProgressLoggerClient::ConsoleProgressLoggerClient () {}
6365
6466 ConsoleProgressLoggerClient::~ConsoleProgressLoggerClient () {}
6567
66- void ConsoleProgressLoggerClient::start ( index_t nb_steps )
68+ void ConsoleProgressLoggerClient::start (
69+ const std::string& message, index_t nb_steps )
6770 {
68- impl_->start ( message () , nb_steps );
71+ impl_->start ( message, nb_steps );
6972 }
7073
7174 void ConsoleProgressLoggerClient::update (
7275 index_t current, index_t nb_steps )
7376 {
74- impl_->update ( message (), current, nb_steps );
77+ impl_->update ( current, nb_steps );
78+ }
79+
80+ void ConsoleProgressLoggerClient::completed ()
81+ {
82+ impl_->completed ();
7583 }
7684
77- void ConsoleProgressLoggerClient::end ( index_t current, index_t nb_steps )
85+ void ConsoleProgressLoggerClient::failed ( )
7886 {
79- impl_->end ( message (), current, nb_steps );
87+ impl_->failed ( );
8088 }
8189} // namespace geode
0 commit comments