From c6ecd9316e721a4800a83f01ecd746f1d0e6a64f Mon Sep 17 00:00:00 2001 From: HanishKVC Date: Sat, 4 May 2024 17:20:52 +0530 Subject: [PATCH] SimpCfg: Use to_str instead of using stringstream directly --- common/simpcfg.hpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/common/simpcfg.hpp b/common/simpcfg.hpp index af50d45d2..ac497e7d7 100644 --- a/common/simpcfg.hpp +++ b/common/simpcfg.hpp @@ -295,9 +295,9 @@ public: void set_value(const std::string &group, const std::string &key, const SupportedDataType &value, const std::string &callerName="") { auto &gm = mapV[group]; gm[key] = value; - std::stringstream ss; - ss << value; - LDBUG_LN("DBUG:SC:%s_%s:%s:%s:%s", __func__, callerName.c_str(), group.c_str(), key.c_str(), ss.str().c_str()); +#ifdef SC_DEBUG + LDBUG_LN("DBUG:SC:%s_%s:%s:%s:%s", __func__, callerName.c_str(), group.c_str(), key.c_str(), to_str(value).c_str()); +#endif } void set_string(const std::string &group, const std::string &key, const std::string &value) { @@ -349,13 +349,15 @@ public: SupportedDataType get_value(const std::string &group, const std::string &key, const SupportedDataType &defaultValue, const std::string &callerName="") { auto gm = mapV[group]; if (gm.find(key) == gm.end()) { - std::stringstream ss; - ss << defaultValue; - LWARN_LN("DBUG:SC:%s_%s:%s:%s:%s[default]", __func__, callerName.c_str(), group.c_str(), key.c_str(), ss.str().c_str()); +#ifdef SC_DEBUG + LWARN_LN("WARN:SC:%s_%s:%s:%s:%s[default]", __func__, callerName.c_str(), group.c_str(), key.c_str(), to_str(defaultValue).c_str()); +#endif return defaultValue; } auto value = gm[key]; +#ifdef SC_DEBUG LDBUG_LN("DBUG:SC:%s_%s:%s:%s:%s", __func__, callerName.c_str(), group.c_str(), key.c_str(), to_str(value).c_str()); +#endif return std::get(value); }