Add --log-file command line parameter

This commit is contained in:
Matt Hess
2026-01-21 22:20:47 +00:00
parent a5908e7560
commit f0b58de64a
5 changed files with 13 additions and 1 deletions
+1 -1
View File
@@ -132,7 +132,7 @@ public:
std::setlocale(LC_ALL, "en_001");
m_logFilePath = DATA_DIR + log_file_name;
m_logFilePath = LOG_FILE_PATH.empty() ? (DATA_DIR + log_file_name) : LOG_FILE_PATH;
m_buf.resize(BUF_SIZE);
+5
View File
@@ -72,6 +72,7 @@ void p2pool_usage()
"--light-mode Don't allocate RandomX dataset, saves 2GB of RAM\n"
"--loglevel Verbosity of the log, integer number between 0 and %d\n"
"--data-dir Path to store general p2pool files (log, cache, peer data, etc.), default is current directory\n"
"--log-file Path to the log file, default is \"p2pool.log\" in p2pool's working directory\n"
"--sidechain-config Name of the p2pool sidechain parameters file (only use it if you run your own sidechain)\n"
"--data-api Path to the p2pool JSON data (use it in tandem with an external web-server). Not affected by --data-dir setting!\n"
"--local-api Enable /local/ path in api path for Stratum Server and built-in miner statistics\n"
@@ -290,6 +291,10 @@ int main(int argc, char* argv[])
p2pool::fixup_path(p2pool::DATA_DIR);
}
if ((strcmp(argv[i], "--log-file") == 0) && (i + 1 < argc)) {
p2pool::LOG_FILE_PATH = argv[++i];
}
if ((strcmp(argv[i], "--params-file") == 0) && (i + 1 < argc)) {
params_file = argv[++i];
}
+5
View File
@@ -130,6 +130,11 @@ Params::Params(const std::vector<std::vector<std::string>>& args)
ok = true;
}
if ((arg[0] == "log-file") && has1(arg)) {
// Processed in main.cpp
ok = true;
}
if ((arg[0] == "sidechain-config") && has1(arg)) {
m_sidechainConfig = arg[1];
ok = true;
+1
View File
@@ -161,6 +161,7 @@ secure_zero_memory(volatile void* data, size_t size)
const uint8_t ED25519_MASTER_PUBLIC_KEY[32] = {51,175,37,73,203,241,188,115,195,255,123,53,218,120,90,74,186,240,82,178,67,139,124,91,180,106,188,181,187,51,236,10};
std::string DATA_DIR;
std::string LOG_FILE_PATH;
SoftwareID get_software_id(uint32_t value)
{
+1
View File
@@ -45,6 +45,7 @@ extern const char* VERSION;
extern const uint8_t ED25519_MASTER_PUBLIC_KEY[32];
extern std::string DATA_DIR;
extern std::string LOG_FILE_PATH;
enum class SoftwareID : uint32_t {
P2Pool = 0,