diff options
Diffstat (limited to 'src/buildtool/progress_reporting')
-rw-r--r-- | src/buildtool/progress_reporting/TARGETS | 3 | ||||
-rw-r--r-- | src/buildtool/progress_reporting/progress_reporter.cpp | 13 | ||||
-rw-r--r-- | src/buildtool/progress_reporting/progress_reporter.hpp | 7 |
3 files changed, 13 insertions, 10 deletions
diff --git a/src/buildtool/progress_reporting/TARGETS b/src/buildtool/progress_reporting/TARGETS index c8100ba0..adc6f8c5 100644 --- a/src/buildtool/progress_reporting/TARGETS +++ b/src/buildtool/progress_reporting/TARGETS @@ -29,9 +29,10 @@ , "progress" , ["@", "gsl", "", "gsl"] , ["src/buildtool/common", "common"] + , ["src/buildtool/logging", "logging"] ] , "private-deps": - [["@", "fmt", "", "fmt"], ["src/buildtool/logging", "logging"]] + [["@", "fmt", "", "fmt"], ["src/buildtool/logging", "log_level"]] } , "base_progress_reporter": { "type": ["@", "rules", "CC", "library"] diff --git a/src/buildtool/progress_reporting/progress_reporter.cpp b/src/buildtool/progress_reporting/progress_reporter.cpp index 27960172..94280fe0 100644 --- a/src/buildtool/progress_reporting/progress_reporter.cpp +++ b/src/buildtool/progress_reporting/progress_reporter.cpp @@ -18,12 +18,12 @@ #include "fmt/core.h" #include "src/buildtool/logging/log_level.hpp" -#include "src/buildtool/logging/logger.hpp" -auto ProgressReporter::Reporter( - gsl::not_null<Statistics*> const& stats, - gsl::not_null<Progress*> const& progress) noexcept -> progress_reporter_t { - return BaseProgressReporter::Reporter([stats, progress]() { +auto ProgressReporter::Reporter(gsl::not_null<Statistics*> const& stats, + gsl::not_null<Progress*> const& progress, + Logger const* logger) noexcept + -> progress_reporter_t { + return BaseProgressReporter::Reporter([stats, progress, logger]() { int total = gsl::narrow<int>(progress->OriginMap().size()); // Note: order matters; queued has to be queried last auto const& sample = progress->TaskTracker().Sample(); @@ -53,7 +53,8 @@ auto ProgressReporter::Reporter( if (total_work > 0) { progress = run * kOneHundred / total_work; } - Logger::Log(LogLevel::Progress, + Logger::Log(logger, + LogLevel::Progress, "[{:3}%] {} cached, {} run, {} processing{}.", progress, cached, diff --git a/src/buildtool/progress_reporting/progress_reporter.hpp b/src/buildtool/progress_reporting/progress_reporter.hpp index 1c4206de..13136579 100644 --- a/src/buildtool/progress_reporting/progress_reporter.hpp +++ b/src/buildtool/progress_reporting/progress_reporter.hpp @@ -17,14 +17,15 @@ #include "gsl/gsl" #include "src/buildtool/common/statistics.hpp" +#include "src/buildtool/logging/logger.hpp" #include "src/buildtool/progress_reporting/base_progress_reporter.hpp" #include "src/buildtool/progress_reporting/progress.hpp" class ProgressReporter { public: - [[nodiscard]] static auto Reporter( - gsl::not_null<Statistics*> const& stats, - gsl::not_null<Progress*> const& progress) noexcept + [[nodiscard]] static auto Reporter(gsl::not_null<Statistics*> const& stats, + gsl::not_null<Progress*> const& progress, + Logger const* logger = nullptr) noexcept -> progress_reporter_t; }; |