From 7480e93f28b765516f7920b43d2cbaa5fe2ab8a0 Mon Sep 17 00:00:00 2001 From: Gareth Sylvester-Bradley Date: Fri, 23 Feb 2024 10:03:44 +0000 Subject: [PATCH] Log URLs rather than just host and port --- Development/nmos/node_behaviour.cpp | 4 ++-- Development/nmos/node_server.cpp | 9 ++++++++- Development/nmos/registry_server.cpp | 24 +++++++++++++++++++++--- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/Development/nmos/node_behaviour.cpp b/Development/nmos/node_behaviour.cpp index 85ba40e0d..01bcc3617 100644 --- a/Development/nmos/node_behaviour.cpp +++ b/Development/nmos/node_behaviour.cpp @@ -784,7 +784,7 @@ namespace nmos self_id = id_type.first; - slog::log(gate, SLOG_FLF) << "Registering nmos-cpp node with the Registration API at: " << registration_client->base_uri().host() << ":" << registration_client->base_uri().port(); + slog::log(gate, SLOG_FLF) << "Registering nmos-cpp node with the Registration API at: " << registration_client->base_uri().to_string(); auto token = cancellation_source.get_token(); request = details::request_registration(*registration_client, events.at(0), gate, token).then([&](pplx::task finally) @@ -908,7 +908,7 @@ namespace nmos // "The first interaction with a new Registration API [after a server side or connectivity issue] // should be a heartbeat to confirm whether whether the Node is still present in the registry" - slog::log(gate, SLOG_FLF) << "Attempting registration heartbeats with the Registration API at: " << registration_client->base_uri().host() << ":" << registration_client->base_uri().port(); + slog::log(gate, SLOG_FLF) << "Attempting registration heartbeats with the Registration API at: " << registration_client->base_uri().to_string(); node_registered = false; diff --git a/Development/nmos/node_server.cpp b/Development/nmos/node_server.cpp index 6d8d5fb99..3202e5e61 100644 --- a/Development/nmos/node_server.cpp +++ b/Development/nmos/node_server.cpp @@ -5,6 +5,7 @@ #include "nmos/channelmapping_activation.h" #include "nmos/events_api.h" #include "nmos/events_ws_api.h" +#include "nmos/is04_versions.h" #include "nmos/logging_api.h" #include "nmos/manifest_api.h" #include "nmos/model.h" @@ -25,7 +26,13 @@ namespace nmos { // Log the API addresses we'll be using - slog::log(gate, SLOG_FLF) << "Configuring nmos-cpp node with its primary Node API at: " << nmos::get_host(node_model.settings) << ":" << nmos::fields::node_port(node_model.settings); + slog::log(gate, SLOG_FLF) << "Configuring nmos-cpp node with its primary Node API at: " + << web::uri_builder() + .set_scheme(nmos::http_scheme(node_model.settings)) + .set_host(nmos::get_host(node_model.settings)) + .set_port(nmos::fields::node_port(node_model.settings)) + .set_path(U("/x-nmos/node/") + nmos::make_api_version(*nmos::is04_versions::from_settings(node_model.settings).rbegin())) + .to_string(); nmos::server node_server{ node_model }; diff --git a/Development/nmos/registry_server.cpp b/Development/nmos/registry_server.cpp index 0767ba7ef..540581215 100644 --- a/Development/nmos/registry_server.cpp +++ b/Development/nmos/registry_server.cpp @@ -33,9 +33,27 @@ namespace nmos { // Log the API addresses we'll be using - slog::log(gate, SLOG_FLF) << "Configuring nmos-cpp registry with its primary Node API at: " << nmos::get_host(registry_model.settings) << ":" << nmos::fields::node_port(registry_model.settings); - slog::log(gate, SLOG_FLF) << "Configuring nmos-cpp registry with its primary Registration API at: " << nmos::get_host(registry_model.settings) << ":" << nmos::fields::registration_port(registry_model.settings); - slog::log(gate, SLOG_FLF) << "Configuring nmos-cpp registry with its primary Query API at: " << nmos::get_host(registry_model.settings) << ":" << nmos::fields::query_port(registry_model.settings); + slog::log(gate, SLOG_FLF) << "Configuring nmos-cpp registry with its primary Node API at: " + << web::uri_builder() + .set_scheme(nmos::http_scheme(registry_model.settings)) + .set_host(nmos::get_host(registry_model.settings)) + .set_port(nmos::fields::node_port(registry_model.settings)) + .set_path(U("/x-nmos/node/") + nmos::make_api_version(*nmos::is04_versions::from_settings(registry_model.settings).rbegin())) + .to_string(); + slog::log(gate, SLOG_FLF) << "Configuring nmos-cpp registry with its primary Registration API at: " + << web::uri_builder() + .set_scheme(nmos::http_scheme(registry_model.settings)) + .set_host(nmos::get_host(registry_model.settings)) + .set_port(nmos::fields::registration_port(registry_model.settings)) + .set_path(U("/x-nmos/registration/") + nmos::make_api_version(*nmos::is04_versions::from_settings(registry_model.settings).rbegin())) + .to_string(); + slog::log(gate, SLOG_FLF) << "Configuring nmos-cpp registry with its primary Query API at: " + << web::uri_builder() + .set_scheme(nmos::http_scheme(registry_model.settings)) + .set_host(nmos::get_host(registry_model.settings)) + .set_port(nmos::fields::query_port(registry_model.settings)) + .set_path(U("/x-nmos/query/") + nmos::make_api_version(*nmos::is04_versions::from_settings(registry_model.settings).rbegin())) + .to_string(); nmos::server registry_server{ registry_model };