aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPer Larsson <[email protected]>2021-10-06 13:41:13 +0200
committerPer Larsson <[email protected]>2021-10-06 13:41:13 +0200
commit44ba4f381e0d5bb370dde0b82e308b1230d9a67d (patch)
tree72df670a72deb9cbe645a35395d8823e519c64b3
parentclang-format (diff)
downloadzen-44ba4f381e0d5bb370dde0b82e308b1230d9a67d.tar.xz
zen-44ba4f381e0d5bb370dde0b82e308b1230d9a67d.zip
Added option to specify path to logfile.
-rw-r--r--zenserver/config.cpp1
-rw-r--r--zenserver/config.h1
-rw-r--r--zenserver/diag/logging.cpp3
3 files changed, 4 insertions, 1 deletions
diff --git a/zenserver/config.cpp b/zenserver/config.cpp
index 7a1efe6e8..df3259542 100644
--- a/zenserver/config.cpp
+++ b/zenserver/config.cpp
@@ -91,6 +91,7 @@ ParseGlobalCliOptions(int argc, char* argv[], ZenServerOptions& GlobalOptions, Z
options.add_options()("log-id", "Specify id for adding context to log output", cxxopts::value<std::string>(GlobalOptions.LogId));
options.add_options()("data-dir", "Specify persistence root", cxxopts::value<std::filesystem::path>(GlobalOptions.DataDir));
options.add_options()("content-dir", "Frontend content directory", cxxopts::value<std::filesystem::path>(GlobalOptions.ContentDir));
+ options.add_options()("abslog", "Path to log file", cxxopts::value<std::filesystem::path>(GlobalOptions.AbsLogFile));
options
.add_option("lifetime", "", "owner-pid", "Specify owning process id", cxxopts::value<int>(GlobalOptions.OwnerPid), "<identifier>");
diff --git a/zenserver/config.h b/zenserver/config.h
index ec6d7340a..405e22739 100644
--- a/zenserver/config.h
+++ b/zenserver/config.h
@@ -18,6 +18,7 @@ struct ZenServerOptions
std::string LogId; // Id for tagging log output
std::filesystem::path DataDir; // Root directory for state (used for testing)
std::filesystem::path ContentDir; // Root directory for serving frontend content (experimental)
+ std::filesystem::path AbsLogFile;
};
struct ZenUpstreamJupiterConfig
diff --git a/zenserver/diag/logging.cpp b/zenserver/diag/logging.cpp
index bc7b883b5..8cec7ddc9 100644
--- a/zenserver/diag/logging.cpp
+++ b/zenserver/diag/logging.cpp
@@ -196,7 +196,8 @@ InitializeLogging(const ZenServerOptions& GlobalOptions)
EnableVTMode();
- std::filesystem::path LogPath = GlobalOptions.DataDir / "logs/zenserver.log";
+ std::filesystem::path LogPath =
+ !GlobalOptions.AbsLogFile.empty() ? GlobalOptions.AbsLogFile : GlobalOptions.DataDir / "logs/zenserver.log";
bool IsAsync = true;
spdlog::level::level_enum LogLevel = spdlog::level::info;