aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/config.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2025-08-22 18:16:09 +0200
committerGitHub Enterprise <[email protected]>2025-08-22 18:16:09 +0200
commitfb6426127354415505dbedacd63b3a16116dac2f (patch)
treebbc39a085433b1e837fb07ea4e4399ba932dbdca /src/zenserver/config.cpp
parentavoid new in static IoBuffer (#472) (diff)
downloadzen-fb6426127354415505dbedacd63b3a16116dac2f.tar.xz
zen-fb6426127354415505dbedacd63b3a16116dac2f.zip
clean up trace options parsing (#473)
* clean up trace command line options explicitly shut down worker pools * some additional startup trace scopes
Diffstat (limited to 'src/zenserver/config.cpp')
-rw-r--r--src/zenserver/config.cpp24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/zenserver/config.cpp b/src/zenserver/config.cpp
index 23bb3ad78..4049ae815 100644
--- a/src/zenserver/config.cpp
+++ b/src/zenserver/config.cpp
@@ -461,6 +461,8 @@ ParseConfigFile(const std::filesystem::path& Path,
const cxxopts::ParseResult& CmdLineResult,
std::string_view OutputConfigFile)
{
+ ZEN_TRACE_CPU("ParseConfigFile");
+
using namespace std::literals;
LuaConfig::Options LuaOptions;
@@ -508,8 +510,9 @@ ParseConfigFile(const std::filesystem::path& Path,
#if ZEN_WITH_TRACE
////// trace
- LuaOptions.AddOption("trace.host"sv, ServerOptions.TraceHost, "tracehost"sv);
- LuaOptions.AddOption("trace.file"sv, ServerOptions.TraceFile, "tracefile"sv);
+ LuaOptions.AddOption("trace.channels"sv, ServerOptions.TraceOptions.Channels, "trace"sv);
+ LuaOptions.AddOption("trace.host"sv, ServerOptions.TraceOptions.Host, "tracehost"sv);
+ LuaOptions.AddOption("trace.file"sv, ServerOptions.TraceOptions.File, "tracefile"sv);
#endif
////// stats
@@ -924,25 +927,28 @@ ParseCliOptions(int argc, char* argv[], ZenServerOptions& ServerOptions)
"<httpsys request logging>");
#if ZEN_WITH_TRACE
+ // We only have this in options for command line help purposes - we parse these argument separately earlier using
+ // GetTraceOptionsFromCommandline()
+
options.add_option("ue-trace",
"",
"trace",
"Specify which trace channels should be enabled",
- cxxopts::value<std::string>(ServerOptions.TraceChannels)->default_value(""),
+ cxxopts::value<std::string>(ServerOptions.TraceOptions.Channels)->default_value(""),
"");
options.add_option("ue-trace",
"",
"tracehost",
"Hostname to send the trace to",
- cxxopts::value<std::string>(ServerOptions.TraceHost)->default_value(""),
+ cxxopts::value<std::string>(ServerOptions.TraceOptions.Host)->default_value(""),
"");
options.add_option("ue-trace",
"",
"tracefile",
"Path to write a trace to",
- cxxopts::value<std::string>(ServerOptions.TraceFile)->default_value(""),
+ cxxopts::value<std::string>(ServerOptions.TraceOptions.File)->default_value(""),
"");
#endif // ZEN_WITH_TRACE
@@ -1342,6 +1348,14 @@ ParseCliOptions(int argc, char* argv[], ZenServerOptions& ServerOptions)
exit(0);
}
+ if (!ServerOptions.HasTraceCommandlineOptions)
+ {
+ // Apply any Lua settings if we don't have them set from the command line
+ TraceConfigure(ServerOptions.TraceOptions);
+ }
+
+ ZEN_TRACE_CPU("ConfigParse");
+
for (int i = 0; i < logging::level::LogLevelCount; ++i)
{
logging::ConfigureLogLevels(logging::level::LogLevel(i), ServerOptions.Loggers[i]);