Skip to content

Commit

Permalink
Merge pull request #2415 from o2genum/topic-log-parameter
Browse files Browse the repository at this point in the history
--log CLI parameter
  • Loading branch information
psychocrypt authored Apr 30, 2019
2 parents 0f5e20d + 94063f3 commit cf1be39
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
14 changes: 14 additions & 0 deletions xmrstak/cli/cli-miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ void help()
cout << " --noNVIDIA disable the NVIDIA miner backend" << endl;
cout << " --nvidia FILE NVIDIA backend miner config file" << endl;
#endif
cout << " --log FILE miner output file" << endl;
#ifndef CONF_NO_HTTPD
cout << " -i --httpd HTTP_PORT HTTP interface port" << endl;
#endif
Expand Down Expand Up @@ -388,6 +389,8 @@ void do_guided_config()
}

configTpl.replace("HTTP_PORT", std::to_string(http_port));

configTpl.replace("OUTPUT_FILE", params::inst().outputFile);
configTpl.write(params::inst().configFile);
std::cout << "Configuration stored in file '" << params::inst().configFile << "'" << std::endl;
}
Expand Down Expand Up @@ -657,6 +660,17 @@ int main(int argc, char* argv[])
}
params::inst().configFilePools = argv[i];
}
else if(opName.compare("--log") == 0)
{
++i;
if(i >= argc)
{
printer::inst()->print_msg(L0, "No argument for parameter '--log' given");
win_exit();
return 1;
}
params::inst().outputFile = argv[i];
}
else if(opName.compare("-i") == 0 || opName.compare("--httpd") == 0)
{
++i;
Expand Down
2 changes: 1 addition & 1 deletion xmrstak/config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ R"===(// generated by XMRSTAK_VERSION
* output_file - This option will log all output to a file.
*
*/
"output_file" : "",
"output_file" : "OUTPUT_FILE",

/*
* Built-in web server
Expand Down
5 changes: 4 additions & 1 deletion xmrstak/jconf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,10 @@ bool jconf::DaemonMode()

const char* jconf::GetOutputFile()
{
return prv->configValues[sOutputFile]->GetString();
if(xmrstak::params::inst().outputFile.length() > 0)
return xmrstak::params::inst().outputFile.c_str();
else
return prv->configValues[sOutputFile]->GetString();
}

void jconf::cpuid(uint32_t eax, int32_t ecx, int32_t val[4])
Expand Down
2 changes: 2 additions & 0 deletions xmrstak/params.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ struct params
std::string configFileNVIDIA;
std::string configFileCPU;

std::string outputFile;

bool allowUAC = true;
std::string minerArg0;
std::string minerArgs;
Expand Down

0 comments on commit cf1be39

Please sign in to comment.