From df4ac66b272d1e26df42855143dda79fc268b558 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Thu, 6 Jun 2024 16:33:19 +0200 Subject: tc writing: allow different log level ... for failures instead of the binary strict_logging. In this way, we can log at log level Error in the serve instance, and for the client at level Warning or Info, depending on whether failure is expected (i.e., if targets are potentially taken from a serve endpoint) or not. --- src/buildtool/main/build_utils.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'src/buildtool/main/build_utils.cpp') diff --git a/src/buildtool/main/build_utils.cpp b/src/buildtool/main/build_utils.cpp index b29ff0c5..fb60ea15 100644 --- a/src/buildtool/main/build_utils.cpp +++ b/src/buildtool/main/build_utils.cpp @@ -160,7 +160,7 @@ void WriteTargetCacheEntries( TargetCacheWriteStrategy strategy, TargetCache const& tc, Logger const* logger, - bool strict_logging) { + LogLevel log_level) { if (strategy == TargetCacheWriteStrategy::Disable) { return; } @@ -186,12 +186,11 @@ void WriteTargetCacheEntries( &ts, cache_targets_ids, []([[maybe_unused]] auto _) {}, // map doesn't set anything - [&failed, logger, strict_logging](auto const& msg, bool fatal) { - Logger::Log( - logger, - strict_logging ? LogLevel::Error : LogLevel::Warning, - "While writing target cache entries:\n{}", - msg); + [&failed, logger, log_level](auto const& msg, bool fatal) { + Logger::Log(logger, + log_level, + "While writing target cache entries:\n{}", + msg); failed = failed or fatal; }); } @@ -201,9 +200,7 @@ void WriteTargetCacheEntries( } if (auto error = DetectAndReportCycle( "writing cache targets", tc_writer_map, kObjectInfoPrinter)) { - Logger::Log(logger, - strict_logging ? LogLevel::Error : LogLevel::Warning, - *error); + Logger::Log(logger, log_level, *error); return; } -- cgit v1.2.3