From f68f8b41a9c02100c04fbe07d38ded16119ab5df Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Mon, 4 Apr 2022 14:40:01 +0200 Subject: Hardlinking: when error is expected, log only at debug level --- src/buildtool/file_system/file_system_manager.hpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/buildtool/file_system/file_system_manager.hpp') diff --git a/src/buildtool/file_system/file_system_manager.hpp b/src/buildtool/file_system/file_system_manager.hpp index c5538c49..f7a499a3 100644 --- a/src/buildtool/file_system/file_system_manager.hpp +++ b/src/buildtool/file_system/file_system_manager.hpp @@ -105,12 +105,13 @@ class FileSystemManager { [[nodiscard]] static auto CreateFileHardlink( std::filesystem::path const& file_path, - std::filesystem::path const& link_path) noexcept -> bool { + std::filesystem::path const& link_path, + LogLevel log_failure_at = LogLevel::Error) noexcept -> bool { try { std::filesystem::create_hard_link(file_path, link_path); return std::filesystem::is_regular_file(link_path); } catch (std::exception const& e) { - Logger::Log(LogLevel::Error, + Logger::Log(log_failure_at, "hard linking {} to {}\n{}", file_path.string(), link_path.string(), @@ -123,13 +124,14 @@ class FileSystemManager { requires(IsFileObject(kType)) [[nodiscard]] static auto CreateFileHardlinkAs( std::filesystem::path const& file_path, - std::filesystem::path const& link_path) noexcept -> bool { + std::filesystem::path const& link_path, + LogLevel log_failure_at = LogLevel::Error) noexcept -> bool { // Set permissions first (permissions are a property of the file) so // that the created link has the correct permissions as soon as the link // creation is finished. return SetFilePermissions(file_path, IsExecutableObject(kType)) and (not kSetEpochTime or SetEpochTime(file_path)) and - CreateFileHardlink(file_path, link_path); + CreateFileHardlink(file_path, link_path, log_failure_at); } template -- cgit v1.2.3