diff options
Diffstat (limited to 'src/zenserver/admin/admin.cpp')
| -rw-r--r-- | src/zenserver/admin/admin.cpp | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/src/zenserver/admin/admin.cpp b/src/zenserver/admin/admin.cpp index 8c2e6d771..f6ad14422 100644 --- a/src/zenserver/admin/admin.cpp +++ b/src/zenserver/admin/admin.cpp @@ -594,31 +594,35 @@ HttpAdminService::HttpAdminService(GcScheduler& Scheduler, [this](HttpRouterRequest& Req) { HttpServerRequest& HttpReq = Req.ServerRequest(); const HttpServerRequest::QueryParams Params = HttpReq.GetQueryParams(); - TraceType Type = TraceType::None; - std::string HostOrPath; - if (auto Param = Params.GetValue("file"); Param.empty() == false) + TraceOptions TraceOptions; + + if (!IsTracing()) { - Type = TraceType::File; - HostOrPath = Param; + TraceInit("zenserver"); } - if (auto Param = Params.GetValue("host"); Param.empty() == false) + + if (auto Channels = Params.GetValue("channels"); Channels.empty() == false) { - Type = TraceType::Network; - HostOrPath = Param; + TraceOptions.Channels = Channels; } - if (Type == TraceType::None) + + if (auto File = Params.GetValue("file"); File.empty() == false) { - return Req.ServerRequest().WriteResponse(HttpResponseCode::BadRequest, - HttpContentType::kText, - "Invalid trace type, use `file` or `host`"sv); + TraceOptions.File = File; } - if (IsTracing()) + else if (auto Host = Params.GetValue("host"); Host.empty() == false) + { + TraceOptions.Host = Host; + } + else { return Req.ServerRequest().WriteResponse(HttpResponseCode::BadRequest, HttpContentType::kText, - "Tracing is already enabled"sv); + "Invalid trace type, use `file` or `host`"sv); } - TraceStart("zenserver", HostOrPath.c_str(), Type); + + TraceConfigure(TraceOptions); + return Req.ServerRequest().WriteResponse(HttpResponseCode::OK, HttpContentType::kText, "Tracing started"); }, HttpVerb::kPost); |