From 95a57f15ca795eb1b36363b7d6db6b88bfe444e2 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 19 May 2020 04:52:47 +0100 Subject: refactor(3p/nix/nix-*): Replace logging with glog in binaries --- third_party/nix/src/nix-prefetch-url/nix-prefetch-url.cc | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'third_party/nix/src/nix-prefetch-url') diff --git a/third_party/nix/src/nix-prefetch-url/nix-prefetch-url.cc b/third_party/nix/src/nix-prefetch-url/nix-prefetch-url.cc index 223f65c4a8e4..0f6b9454c0bf 100644 --- a/third_party/nix/src/nix-prefetch-url/nix-prefetch-url.cc +++ b/third_party/nix/src/nix-prefetch-url/nix-prefetch-url.cc @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -10,7 +11,6 @@ #include "finally.hh" #include "hash.hh" #include "legacy.hh" -#include "progress-bar.hh" #include "shared.hh" #include "store-api.hh" @@ -92,10 +92,6 @@ static int _main(int argc, char** argv) { if (args.size() > 2) throw UsageError("too many arguments"); - Finally f([]() { stopProgressBar(); }); - - if (isatty(STDERR_FILENO)) startProgressBar(); - auto store = openStore(); auto state = std::make_unique(myArgs.searchPath, store); @@ -126,7 +122,7 @@ static int _main(int argc, char** argv) { /* Extract the hash mode. */ attr = v.attrs->find(state->symbols.create("outputHashMode")); if (attr == v.attrs->end()) - printInfo("warning: this does not look like a fetchurl call"); + LOG(WARNING) << "this does not look like a fetchurl call"; else unpack = state->forceString(*attr->value) == "recursive"; @@ -176,7 +172,7 @@ static int _main(int argc, char** argv) { /* Optionally unpack the file. */ if (unpack) { - printInfo("unpacking..."); + LOG(INFO) << "unpacking..."; Path unpacked = (Path)tmpDir + "/unpacked"; createDirs(unpacked); if (hasSuffix(baseNameOf(uri), ".zip")) @@ -210,9 +206,9 @@ static int _main(int argc, char** argv) { assert(storePath == store->makeFixedOutputPath(unpack, hash, name)); } - stopProgressBar(); - - if (!printPath) printInfo(format("path is '%1%'") % storePath); + if (!printPath) { + LOG(INFO) << "path is '" << storePath << "'"; + } std::cout << printHash16or32(hash) << std::endl; if (printPath) std::cout << storePath << std::endl; -- cgit 1.4.1