common: avoid std::ofstream copy

Using a copy constructor to set the logfile is the only thing that
stops compilation with the libstdc++ shipping with gcc 4.8 (maybe 4.7)
This commit is contained in:
Janos Farkas 2019-04-02 16:39:21 +00:00
parent 2e246c1968
commit 587b022b0a

View File

@ -87,8 +87,8 @@ bool CommandHandler::executeBeforeContext()
if (vm.count("log")) {
std::string logfilename = vm["log"].as<std::string>();
logfile = std::ofstream(logfilename);
if (!logfile)
logfile.open(logfilename);
if (!logfile.is_open())
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));
}