aboutsummaryrefslogtreecommitdiff
path: root/src/nix/main.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-06-11 15:45:18 +0200
committerGitHub <noreply@github.com>2020-06-11 15:45:18 +0200
commitac4d43a31bb32c1205b44d69e87606b7f54922a1 (patch)
tree692e5202bb25b33292000d6f6eb81a78a503ce74 /src/nix/main.cc
parentb9ae1bdd7a1ed8eee25fc37c97d74c1d6771778d (diff)
parentdd9bb11d0d38139bb32411170403171c4c92f8cf (diff)
Merge pull request #3073 from tweag/machine-logs
Add an option to print the logs in a machine-readable format
Diffstat (limited to 'src/nix/main.cc')
-rw-r--r--src/nix/main.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/nix/main.cc b/src/nix/main.cc
index 1120ba5ef..203901168 100644
--- a/src/nix/main.cc
+++ b/src/nix/main.cc
@@ -10,6 +10,7 @@
#include "progress-bar.hh"
#include "filetransfer.hh"
#include "finally.hh"
+#include "loggers.hh"
#include <sys/types.h>
#include <sys/socket.h>
@@ -90,7 +91,7 @@ struct NixArgs : virtual MultiCommand, virtual MixCommonArgs
.longName = "print-build-logs",
.shortName = 'L',
.description = "print full build logs on stderr",
- .handler = {&printBuildLogs, true},
+ .handler = {[&]() {setLogFormat(LogFormat::barWithLogs); }},
});
addFlag({
@@ -165,6 +166,10 @@ void mainWrapped(int argc, char * * argv)
verbosity = lvlWarn;
settings.verboseBuild = false;
+ setLogFormat("bar");
+
+ Finally f([] { logger->stop(); });
+
NixArgs args;
args.parseCmdline(argvToStrings(argc, argv));
@@ -178,10 +183,6 @@ void mainWrapped(int argc, char * * argv)
&& args.command->first != "upgrade-nix")
settings.requireExperimentalFeature("nix-command");
- Finally f([]() { stopProgressBar(); });
-
- startProgressBar(args.printBuildLogs);
-
if (args.useNet && !haveInternet()) {
warn("you don't have Internet access; disabling some network-dependent features");
args.useNet = false;