summaryrefslogtreecommitdiff
path: root/src/buildtool/main/build_utils.cpp
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2024-06-06 16:33:19 +0200
committerKlaus Aehlig <klaus.aehlig@huawei.com>2024-06-06 16:55:26 +0200
commitdf4ac66b272d1e26df42855143dda79fc268b558 (patch)
treedc84f50a5d9d86949b0b2cba7bc4367e90582df8 /src/buildtool/main/build_utils.cpp
parentf63d3df866a2d75b694c8c484b21fbcdccd58acd (diff)
downloadjustbuild-df4ac66b272d1e26df42855143dda79fc268b558.tar.gz
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.
Diffstat (limited to 'src/buildtool/main/build_utils.cpp')
-rw-r--r--src/buildtool/main/build_utils.cpp17
1 files changed, 7 insertions, 10 deletions
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<true> 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;
}