From 505b6b044b132b28e1501491bcfe6bd68ca1989e Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 19 May 2020 01:02:44 +0100 Subject: refactor(3p/nix/libstore): Replace logging.h with glog --- third_party/nix/src/libstore/binary-cache-store.cc | 47 +++++++++------------- 1 file changed, 20 insertions(+), 27 deletions(-) (limited to 'third_party/nix/src/libstore/binary-cache-store.cc') diff --git a/third_party/nix/src/libstore/binary-cache-store.cc b/third_party/nix/src/libstore/binary-cache-store.cc index a601ef77a3..a9e7057648 100644 --- a/third_party/nix/src/libstore/binary-cache-store.cc +++ b/third_party/nix/src/libstore/binary-cache-store.cc @@ -6,6 +6,7 @@ #include "derivations.hh" #include "fs-accessor.hh" #include "globals.hh" +#include "glog/logging.h" #include "json.hh" #include "nar-accessor.hh" #include "nar-info-disk-cache.hh" @@ -176,12 +177,10 @@ void BinaryCacheStore::addToStore(const ValidPathInfo& info, auto duration = std::chrono::duration_cast(now2 - now1) .count(); - printMsg(lvlTalkative, - format("copying path '%1%' (%2% bytes, compressed %3$.1f%% in %4% " - "ms) to binary cache") % - narInfo->path % narInfo->narSize % - ((1.0 - (double)narCompressed->size() / nar->size()) * 100.0) % - duration); + DLOG(INFO) << "copying path '" << narInfo->path << "' (" << narInfo->narSize + << " bytes, compressed " + << ((1.0 - (double)narCompressed->size() / nar->size()) * 100.0) + << "% in " << duration << "ms) to binary cache"; /* Atomically write the NAR file. */ narInfo->url = "nar/" + narInfo->fileHash.to_string(Base32, false) + ".nar" + @@ -243,35 +242,28 @@ void BinaryCacheStore::queryPathInfoUncached( const Path& storePath, Callback> callback) noexcept { auto uri = getUri(); - auto act = std::make_shared( - *logger, lvlTalkative, actQueryPathInfo, - fmt("querying info about '%s' on '%s'", storePath, uri), - Logger::Fields{storePath, uri}); - PushActivity pact(act->id); + LOG(INFO) << "querying info about '" << storePath << "' on '" << uri << "'"; auto narInfoFile = narInfoFileFor(storePath); auto callbackPtr = std::make_shared(std::move(callback)); - getFile( - narInfoFile, {[=](std::future> fut) { - try { - auto data = fut.get(); + getFile(narInfoFile, {[=](std::future> fut) { + try { + auto data = fut.get(); - if (!data) return (*callbackPtr)(nullptr); + if (!data) return (*callbackPtr)(nullptr); - stats.narInfoRead++; + stats.narInfoRead++; - (*callbackPtr)( - (std::shared_ptr)std::make_shared( - *this, *data, narInfoFile)); + (*callbackPtr)( + (std::shared_ptr)std::make_shared( + *this, *data, narInfoFile)); - (void) - act; // force Activity into this lambda to ensure it stays alive - } catch (...) { - callbackPtr->rethrow(); - } - }}); + } catch (...) { + callbackPtr->rethrow(); + } + }}); } Path BinaryCacheStore::addToStore(const string& name, const Path& srcPath, @@ -356,7 +348,8 @@ std::shared_ptr BinaryCacheStore::getBuildLog(const Path& path) { auto logPath = "log/" + baseNameOf(drvPath); - debug("fetching build log from binary cache '%s/%s'", getUri(), logPath); + DLOG(INFO) << "fetching build log from binary cache '" << getUri() << "/" + << logPath << "'"; return getFile(logPath); } -- cgit 1.4.1