From fb1580b44e1c1d1e43e2d1644fb3afb8f098f591 Mon Sep 17 00:00:00 2001 From: tt2468 Date: Sat, 24 Jul 2021 03:04:53 -0700 Subject: [PATCH] Requests: Add extra logging to GetProfileParameter --- src/requesthandler/RequestHandler_Config.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/requesthandler/RequestHandler_Config.cpp b/src/requesthandler/RequestHandler_Config.cpp index 75ee4c2b..6446be09 100644 --- a/src/requesthandler/RequestHandler_Config.cpp +++ b/src/requesthandler/RequestHandler_Config.cpp @@ -79,9 +79,19 @@ RequestResult RequestHandler::GetProfileParameter(const Request& request) config_t* profile = obs_frontend_get_profile_config(); + if (!profile) + blog(LOG_ERROR, "Profile invalid."); + + std::string parameterValue = config_get_string(profile, parameterCategory.c_str(), parameterName.c_str()); + std::string defaultParameterValue = config_get_default_string(profile, parameterCategory.c_str(), parameterName.c_str()); + if (parameterValue.empty()) + blog(LOG_INFO, "Parameter value is empty."); + if (defaultParameterValue.empty()) + blog(LOG_INFO, "Default parameter value is empty."); + json responseData; - responseData["parameterValue"] = config_get_string(profile, parameterCategory.c_str(), parameterName.c_str()); - responseData["defaultParameterValue"] = config_get_default_string(profile, parameterCategory.c_str(), parameterName.c_str()); + responseData["parameterValue"] = parameterValue; + responseData["defaultParameterValue"] = defaultParameterValue; return RequestResult::Success(responseData); }