summaryrefslogtreecommitdiff
path: root/src/buildtool/file_system/git_cas.cpp
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2025-01-22 11:55:59 +0100
committerKlaus Aehlig <klaus.aehlig@huawei.com>2025-01-22 16:05:29 +0100
commitfc9f622cba6b6671f5b5f0371de9bf31ae75c7d1 (patch)
treec28e4d52ede9302c14412d636ce97d7ef55b9436 /src/buildtool/file_system/git_cas.cpp
parentcf7bdda108ef7bfe2efc612725f99946dc30c774 (diff)
downloadjustbuild-fc9f622cba6b6671f5b5f0371de9bf31ae75c7d1.tar.gz
Git CAS access: reduce log level
Trying to access a git object return a recoverable failure, hence the failure to find the object in the git object database should be logged at warning level at most. Moreover, in some cases we should log that event at an even lower level, e.g., if we're just checking the presence of the object in the local git cas to avoid unnecessary network access.
Diffstat (limited to 'src/buildtool/file_system/git_cas.cpp')
-rw-r--r--src/buildtool/file_system/git_cas.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/buildtool/file_system/git_cas.cpp b/src/buildtool/file_system/git_cas.cpp
index 295b5783..1af1dde2 100644
--- a/src/buildtool/file_system/git_cas.cpp
+++ b/src/buildtool/file_system/git_cas.cpp
@@ -134,7 +134,9 @@ auto GitCAS::CreateEmpty() noexcept -> GitCASPtr {
#endif
}
-auto GitCAS::ReadObject(std::string const& id, bool is_hex_id) const noexcept
+auto GitCAS::ReadObject(std::string const& id,
+ bool is_hex_id,
+ LogLevel log_failure) const noexcept
-> std::optional<std::string> {
#ifdef BOOTSTRAP_BUILD_TOOL
return std::nullopt;
@@ -150,7 +152,7 @@ auto GitCAS::ReadObject(std::string const& id, bool is_hex_id) const noexcept
git_odb_object* obj = nullptr;
if (git_odb_read(&obj, odb_.get(), &oid.value()) != 0) {
- Logger::Log(LogLevel::Error,
+ Logger::Log(log_failure,
"reading git object {} from database failed with:\n{}",
is_hex_id ? id : ToHexString(id),
GitLastError());