aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorDavid Shah <davey1576@gmail.com>2019-01-01 16:39:17 +0100
committerGitHub <noreply@github.com>2019-01-01 16:39:17 +0100
commit67d2dcb0a84c167e92b993b2b93f0678835d3403 (patch)
treefce692debd9966327257a07ef5b0140b965519a7 /common
parenteb456ef476e8342b4709d71cbff6ef22a714d6ec (diff)
parent7f69c0f455fcaa1edddae111c79b2a88b48ea1b5 (diff)
downloadnextpnr-67d2dcb0a84c167e92b993b2b93f0678835d3403.tar.gz
nextpnr-67d2dcb0a84c167e92b993b2b93f0678835d3403.tar.bz2
nextpnr-67d2dcb0a84c167e92b993b2b93f0678835d3403.zip
Merge pull request #197 from YosysHQ/fix_192
command: Setup logging before attempting to create Context
Diffstat (limited to 'common')
-rw-r--r--common/command.cc28
1 files changed, 14 insertions, 14 deletions
diff --git a/common/command.cc b/common/command.cc
index d332375a..6ba3442f 100644
--- a/common/command.cc
+++ b/common/command.cc
@@ -77,6 +77,20 @@ bool CommandHandler::executeBeforeContext()
return true;
}
validate();
+
+ if (vm.count("quiet")) {
+ log_streams.push_back(std::make_pair(&std::cerr, LogLevel::WARNING_MSG));
+ } else {
+ log_streams.push_back(std::make_pair(&std::cerr, LogLevel::LOG_MSG));
+ }
+
+ if (vm.count("log")) {
+ std::string logfilename = vm["log"].as<std::string>();
+ logfile = std::ofstream(logfilename);
+ if (!logfile)
+ log_error("Failed to open log file '%s' for writing.\n", logfilename.c_str());
+ log_streams.push_back(std::make_pair(&logfile, LogLevel::LOG_MSG));
+ }
return false;
}
@@ -130,20 +144,6 @@ void CommandHandler::setupContext(Context *ctx)
ctx->debug = true;
}
- if (vm.count("quiet")) {
- log_streams.push_back(std::make_pair(&std::cerr, LogLevel::WARNING_MSG));
- } else {
- log_streams.push_back(std::make_pair(&std::cerr, LogLevel::LOG_MSG));
- }
-
- if (vm.count("log")) {
- std::string logfilename = vm["log"].as<std::string>();
- logfile = std::ofstream(logfilename);
- if (!logfile)
- log_error("Failed to open log file '%s' for writing.\n", logfilename.c_str());
- log_streams.push_back(std::make_pair(&logfile, LogLevel::LOG_MSG));
- }
-
if (vm.count("force")) {
ctx->force = true;
}