From d43c3c93db4a412bd9efe8c19170daff1b8eacb1 Mon Sep 17 00:00:00 2001 From: Karunakaran A Date: Thu, 3 Oct 2024 16:13:38 -0400 Subject: [PATCH] DELIA-66446 : Implement RDKLogger Support to NetworkManager Plugin Reason for change: Additional Changes to support RDKLogger Test Procedure: Verify logs are printed properly Risks: Low Signed-off-by: Karunakaran A --- INetworkManager.h | 3 +- LegacyPlugin_NetworkAPIs.cpp | 106 +++++++++++----------- LegacyPlugin_WiFiManagerAPIs.cpp | 66 +++++++------- NetworkManagerConnectivity.cpp | 14 ++- NetworkManagerGnomeEvents.cpp | 24 ++--- NetworkManagerGnomeProxy.cpp | 16 ++-- NetworkManagerGnomeUtils.cpp | 10 +-- NetworkManagerGnomeWIFI.cpp | 76 ++++++++-------- NetworkManagerImplementation.cpp | 24 ++--- NetworkManagerImplementation.h | 2 +- NetworkManagerJsonRpc.cpp | 145 ++++++++++++++++--------------- NetworkManagerLogger.cpp | 33 ++++++- NetworkManagerLogger.h | 7 +- NetworkManagerRDKProxy.cpp | 3 +- WiFiSignalStrengthMonitor.cpp | 4 +- 15 files changed, 278 insertions(+), 255 deletions(-) diff --git a/INetworkManager.h b/INetworkManager.h index 4e8ebe8..f50c629 100644 --- a/INetworkManager.h +++ b/INetworkManager.h @@ -167,8 +167,7 @@ namespace WPEFramework LOG_LEVEL_ERROR, LOG_LEVEL_WARNING, LOG_LEVEL_INFO, - LOG_LEVEL_VERBOSE, - LOG_LEVEL_TRACE + LOG_LEVEL_DEBUG }; // The state of the interface diff --git a/LegacyPlugin_NetworkAPIs.cpp b/LegacyPlugin_NetworkAPIs.cpp index 482522d..d380f4e 100644 --- a/LegacyPlugin_NetworkAPIs.cpp +++ b/LegacyPlugin_NetworkAPIs.cpp @@ -29,8 +29,8 @@ using namespace WPEFramework::Plugin; #define SUBSCRIPTION_TIMEOUT_IN_MILLISECONDS 500 #define DEFAULT_PING_PACKETS 15 -#define LOGINFOMETHOD() { string json; parameters.ToString(json); NMLOG_TRACE("Legacy params=%s", json.c_str() ); } -#define LOGTRACEMETHODFIN() { string json; response.ToString(json); NMLOG_TRACE("Legacy response=%s", json.c_str() ); } +#define LOG_INPARAM() { string json; parameters.ToString(json); NMLOG_INFO("%s : params=%s", __FUNCTION__, json.c_str() ); } +#define LOG_OUTPARAM() { string json; response.ToString(json); NMLOG_INFO("%s : response=%s", __FUNCTION__, json.c_str() ); } namespace WPEFramework { @@ -123,7 +123,7 @@ namespace WPEFramework reinterpret_cast(payload.c_str()), token) == Core::ERROR_NONE) { - NMLOG_TRACE("Network plugin got security token"); + NMLOG_DEBUG("Network plugin got security token"); } else { NMLOG_WARNING("Network plugin failed to get security token"); } @@ -278,7 +278,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { JsonObject tmpResponse; JsonArray array; - LOGINFOMETHOD(); + LOG_INPARAM(); if (m_networkmanager) rc = m_networkmanager->Invoke(5000, _T("GetAvailableInterfaces"), parameters, tmpResponse); @@ -303,13 +303,13 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { response["interfaces"] = array; response["success"] = tmpResponse["success"]; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t Network::setStunEndPoint(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; JsonObject tmpParameters; tmpParameters["endPoint"] = parameters["server"]; @@ -322,7 +322,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { else rc = Core::ERROR_UNAVAILABLE; - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } @@ -332,7 +332,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { string interface; JsonObject tmpParameters; - LOGINFOMETHOD(); + LOG_INPARAM(); if(caseInsensitiveCompare(parameters["interface"].String(),"WIFI")) interface = "wlan0"; else if(caseInsensitiveCompare(parameters["interface"].String(), "ETHERNET")) @@ -348,7 +348,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { else rc = Core::ERROR_UNAVAILABLE; - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } @@ -357,7 +357,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { uint32_t rc = Core::ERROR_GENERAL; JsonObject tmpResponse; - LOGINFOMETHOD(); + LOG_INPARAM(); if (m_networkmanager) rc = m_networkmanager->Invoke(5000, _T("GetPrimaryInterface"), parameters, tmpResponse); @@ -372,7 +372,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { response["interface"] = "ETHERNET"; response["success"] = tmpResponse["success"]; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } @@ -381,7 +381,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { uint32_t rc = Core::ERROR_GENERAL; JsonObject tmpParameters; string interface; - LOGINFOMETHOD(); + LOG_INPARAM(); if(caseInsensitiveCompare(parameters["interface"].String(), "WIFI")) tmpParameters["interface"] = "wlan0"; else if(caseInsensitiveCompare(parameters["interface"].String(), "ETHERNET")) @@ -392,7 +392,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { else rc = Core::ERROR_UNAVAILABLE; - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } @@ -402,7 +402,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { uint32_t rc = Core::ERROR_GENERAL; JsonObject tmpResponse; JsonObject tmpParameters; - LOGINFOMETHOD(); + LOG_INPARAM(); if(caseInsensitiveCompare(parameters["interface"].String(), "WIFI")) tmpParameters["interface"] = "wlan0"; @@ -431,7 +431,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { response["supported"] = true; response["success"] = tmpResponse["success"]; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } @@ -440,7 +440,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { uint32_t rc = Core::ERROR_GENERAL; JsonObject tmpResponse; - LOGINFOMETHOD(); + LOG_INPARAM(); rc = getIPSettings2(parameters, tmpResponse); if (tmpResponse.HasLabel("ipaddr")) @@ -451,7 +451,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { response["success"] = false; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } @@ -462,7 +462,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { JsonObject tmpParameters; size_t index; - LOGINFOMETHOD(); + LOG_INPARAM(); if (parameters.HasLabel("ipversion")) tmpParameters["ipversion"] = parameters["ipversion"]; @@ -518,7 +518,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { } response["success"] = tmpResponse["success"]; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } @@ -527,7 +527,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { uint32_t rc = Core::ERROR_GENERAL; JsonObject tmpResponse; - LOGINFOMETHOD(); + LOG_INPARAM(); string ipversion = parameters["ipversion"].String(); if (m_networkmanager) @@ -542,7 +542,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { response["ipversion"] = ipversion.c_str(); response["success"] = true; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t Network::getInternetConnectionState(const JsonObject& parameters, JsonObject& response) @@ -555,7 +555,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { JsonObject tmpParameters; string status; - LOGINFOMETHOD(); + LOG_INPARAM(); string ipversion = parameters["ipversion"].String(); if (m_networkmanager) @@ -566,8 +566,8 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { if (Core::ERROR_NONE == rc) { status = tmpResponse["status"].String(); - NMLOG_TRACE("status = %s", status.c_str() ); - NMLOG_TRACE("tmpResponse[status].String() = %s", tmpResponse["status"].String().c_str() ); + NMLOG_DEBUG("status = %s", status.c_str() ); + NMLOG_DEBUG("tmpResponse[status].String() = %s", tmpResponse["status"].String().c_str() ); if(status == "LIMITED_INTERNET") response["state"] = static_cast(2); else if(status == "CAPTIVE_PORTAL") @@ -586,7 +586,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { response["ipversion"] = ipversion.c_str(); response["success"] = true; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t Network::doPing(const JsonObject& parameters, JsonObject& response) @@ -598,7 +598,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { JsonObject tmpResponse; string endpoint{}; - LOGINFOMETHOD(); + LOG_INPARAM(); endpoint = parameters["endpoint"].String(); @@ -625,13 +625,13 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { response["target"] = parameters["endpoint"]; response["guid"] = parameters["guid"]; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t Network::doTrace(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; JsonObject tmpParameters; tmpParameters["endpoint"] = parameters["endpoint"].String(); @@ -643,7 +643,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { else rc = Core::ERROR_UNAVAILABLE; - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } @@ -655,7 +655,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { JsonObject tmpParameters; JsonObject tmpResponse; - LOGINFOMETHOD(); + LOG_INPARAM(); if(caseInsensitiveCompare(parameters["iface"].String(), "WIFI")) interface = "wlan0"; else if(caseInsensitiveCompare(parameters["iface"].String(), "ETHERNET")) @@ -679,7 +679,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { response["public_ip"] = tmpResponse["publicIP"]; response["success"] = tmpResponse["success"]; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } @@ -688,7 +688,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { uint32_t rc = Core::ERROR_GENERAL; JsonObject tmpParameters; - LOGINFOMETHOD(); + LOG_INPARAM(); string interface = parameters["interface"].String(); string newInterface = ""; @@ -704,44 +704,44 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { else rc = Core::ERROR_UNAVAILABLE; - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t Network::setConnectivityTestEndpoints(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; if (m_networkmanager) rc = m_networkmanager->Invoke(5000, _T("SetConnectivityTestEndpoints"), parameters, response); else rc = Core::ERROR_UNAVAILABLE; - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t Network::startConnectivityMonitoring(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; uint32_t interval = parameters["interval"].Number(); - NMLOG_TRACE("connectivity interval = %d", interval); + NMLOG_DEBUG("connectivity interval = %d", interval); if (m_networkmanager) rc = m_networkmanager->Invoke(5000, _T("StartConnectivityMonitoring"), parameters, response); else rc = Core::ERROR_UNAVAILABLE; - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t Network::getCaptivePortalURI(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; string endPoint; if (m_networkmanager) @@ -749,13 +749,13 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { else rc = Core::ERROR_UNAVAILABLE; - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t Network::stopConnectivityMonitoring(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; if (m_networkmanager) @@ -763,14 +763,14 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { else rc = Core::ERROR_UNAVAILABLE; - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t Network::getStbIp(const JsonObject& parameters, JsonObject& response) { uint32_t rc = Core::ERROR_GENERAL; - LOGTRACEMETHODFIN(); + LOG_INPARAM(); JsonObject tmpResponse; if (m_networkmanager) @@ -783,13 +783,14 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { response["ip"] = tmpResponse["ipaddress"]; response["success"] = true; } + LOG_OUTPARAM(); return rc; } uint32_t Network::getSTBIPFamily(const JsonObject& parameters, JsonObject& response) { uint32_t rc = Core::ERROR_GENERAL; - LOGTRACEMETHODFIN(); + LOG_INPARAM(); JsonObject tmpResponse; JsonObject tmpParameters; @@ -805,6 +806,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { response["ip"] = tmpResponse["ipaddress"]; response["success"] = true; } + LOG_OUTPARAM(); return rc; } @@ -883,7 +885,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { /** Event Handling and Publishing */ void Network::ReportonInterfaceStateChange(const JsonObject& parameters) { - LOGINFOMETHOD(); + LOG_INPARAM(); JsonObject legacyParams; string json; string state = parameters["state"].String(); @@ -916,7 +918,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { void Network::ReportonActiveInterfaceChange(const JsonObject& parameters) { - LOGINFOMETHOD(); + LOG_INPARAM(); JsonObject legacyParams; legacyParams["oldInterfaceName"] = getInterfaceMapping(parameters["oldInterfaceName"].String()); @@ -930,19 +932,17 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { void Network::ReportonIPAddressChange(const JsonObject& parameters) { - LOGINFOMETHOD(); + LOG_INPARAM(); JsonObject legacyParams; legacyParams["interface"] = getInterfaceMapping(parameters["interface"].String()); if (parameters["isIPv6"].Boolean()) { legacyParams["ip6Address"] = parameters["ipAddress"]; - legacyParams["ip4Address"] = ""; } else { legacyParams["ip4Address"] = parameters["ipAddress"]; - legacyParams["ip6Address"] = ""; } legacyParams["status"] = parameters["status"]; @@ -964,7 +964,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { void Network::onInterfaceStateChange(const JsonObject& parameters) { - LOGINFOMETHOD(); + LOG_INPARAM(); if(_gNWInstance) _gNWInstance->ReportonInterfaceStateChange(parameters); @@ -973,7 +973,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { void Network::onActiveInterfaceChange(const JsonObject& parameters) { - LOGINFOMETHOD(); + LOG_INPARAM(); if(_gNWInstance) _gNWInstance->ReportonActiveInterfaceChange(parameters); return; @@ -981,7 +981,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { void Network::onIPAddressChange(const JsonObject& parameters) { - LOGINFOMETHOD(); + LOG_INPARAM(); if(_gNWInstance) _gNWInstance->ReportonIPAddressChange(parameters); return; @@ -989,7 +989,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { void Network::onInternetStatusChange(const JsonObject& parameters) { - LOGINFOMETHOD(); + LOG_INPARAM(); if(_gNWInstance) _gNWInstance->ReportonInternetStatusChange(parameters); } diff --git a/LegacyPlugin_WiFiManagerAPIs.cpp b/LegacyPlugin_WiFiManagerAPIs.cpp index b003d60..ac28724 100644 --- a/LegacyPlugin_WiFiManagerAPIs.cpp +++ b/LegacyPlugin_WiFiManagerAPIs.cpp @@ -28,8 +28,8 @@ using namespace WPEFramework::Plugin; #define NETWORK_MANAGER_CALLSIGN "org.rdk.NetworkManager.1" #define SUBSCRIPTION_TIMEOUT_IN_MILLISECONDS 500 -#define LOGINFOMETHOD() { string json; parameters.ToString(json); NMLOG_TRACE("Legacy params=%s", json.c_str() ); } -#define LOGTRACEMETHODFIN() { string json; response.ToString(json); NMLOG_TRACE("Legacy response=%s", json.c_str() ); } +#define LOG_INPARAM() { string json; parameters.ToString(json); NMLOG_INFO("%s : params=%s", __FUNCTION__, json.c_str() ); } +#define LOG_OUTPARAM() { string json; response.ToString(json); NMLOG_INFO("%s : response=%s", __FUNCTION__, json.c_str() ); } namespace WPEFramework { @@ -120,7 +120,7 @@ namespace WPEFramework reinterpret_cast(payload.c_str()), token) == Core::ERROR_NONE) { - NMLOG_TRACE("WiFi manager plugin got security token"); + NMLOG_DEBUG("WiFi manager plugin got security token"); } else { NMLOG_WARNING("WiFi manager plugin failed to get security token"); } @@ -221,7 +221,7 @@ namespace WPEFramework { uint32_t rc = Core::ERROR_GENERAL; - LOGINFOMETHOD(); + LOG_INPARAM(); if (m_networkmanager) rc = m_networkmanager->Invoke(5000, _T("StopWPS"), parameters, response); @@ -233,7 +233,7 @@ namespace WPEFramework response["result"] = string(); } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } @@ -243,7 +243,7 @@ namespace WPEFramework JsonObject tmpParameters; tmpParameters["ssid"] = "ssid"; // The input ssid name does not matter at this point in time as there is only one ssid persisted at any given point in time. - LOGINFOMETHOD(); + LOG_INPARAM(); if (m_networkmanager) rc = m_networkmanager->Invoke(5000, _T("RemoveKnownSSID"), tmpParameters, response); @@ -255,13 +255,13 @@ namespace WPEFramework response["result"] = 0; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t WiFiManager::connect(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; if (m_networkmanager) @@ -273,7 +273,7 @@ namespace WPEFramework { response["success"] = true; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } @@ -282,7 +282,7 @@ namespace WPEFramework uint32_t rc = Core::ERROR_GENERAL; JsonObject tmpResponse; - LOGINFOMETHOD(); + LOG_INPARAM(); if (m_networkmanager) rc = m_networkmanager->Invoke(5000, _T("GetConnectedSSID"), parameters, tmpResponse); @@ -300,7 +300,7 @@ namespace WPEFramework response["frequency"] = tmpResponse["frequency"]; response["success"] = tmpResponse["success"]; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } @@ -313,13 +313,13 @@ namespace WPEFramework else rc = Core::ERROR_UNAVAILABLE; - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t WiFiManager::getPairedSSID(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; JsonObject tmpResponse; @@ -339,13 +339,13 @@ namespace WPEFramework } response["success"] = tmpResponse["success"]; - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t WiFiManager::getPairedSSIDInfo(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; if (m_networkmanager) @@ -353,13 +353,13 @@ namespace WPEFramework else rc = Core::ERROR_UNAVAILABLE; - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t WiFiManager::getSupportedSecurityModes(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; if (m_networkmanager) @@ -367,14 +367,14 @@ namespace WPEFramework else rc = Core::ERROR_UNAVAILABLE; - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t WiFiManager::isPaired (const JsonObject& parameters, JsonObject& response) { uint32_t rc = Core::ERROR_GENERAL; - LOGINFOMETHOD(); + LOG_INPARAM(); JsonObject tmpResponse; rc = getPairedSSID(parameters, tmpResponse); @@ -392,7 +392,7 @@ namespace WPEFramework } response["success"] = true; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } @@ -400,7 +400,7 @@ namespace WPEFramework { uint32_t rc = Core::ERROR_GENERAL; - LOGINFOMETHOD(); + LOG_INPARAM(); if (m_networkmanager) rc = m_networkmanager->Invoke(5000, _T("AddToKnownSSIDs"), parameters, response); @@ -412,7 +412,7 @@ namespace WPEFramework response["result"] = 0; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } @@ -420,7 +420,7 @@ namespace WPEFramework { uint32_t rc = Core::ERROR_GENERAL; - LOGINFOMETHOD(); + LOG_INPARAM(); if (m_networkmanager) rc = m_networkmanager->Invoke(5000, _T("WiFiDisconnect"), parameters, response); @@ -432,7 +432,7 @@ namespace WPEFramework response["result"] = 0; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } @@ -440,7 +440,7 @@ namespace WPEFramework { uint32_t rc = Core::ERROR_GENERAL; JsonObject tmpParameters; - LOGINFOMETHOD(); + LOG_INPARAM(); if (parameters.HasLabel("method")) { string method = parameters["method"].String(); @@ -470,13 +470,13 @@ namespace WPEFramework { response["result"] = string(); } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t WiFiManager::startScan(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; JsonObject tmpParameters; @@ -485,13 +485,13 @@ namespace WPEFramework else rc = Core::ERROR_UNAVAILABLE; - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t WiFiManager::stopScan(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; if (m_networkmanager) @@ -499,7 +499,7 @@ namespace WPEFramework else rc = Core::ERROR_UNAVAILABLE; - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } @@ -591,7 +591,7 @@ namespace WPEFramework /** Event Handling and Publishing */ void WiFiManager::onWiFiStateChange(const JsonObject& parameters) { - LOGINFOMETHOD(); + LOG_INPARAM(); JsonObject legacyResult; JsonObject legacyErrorResult; uint32_t errorCode; @@ -621,7 +621,7 @@ namespace WPEFramework void WiFiManager::onAvailableSSIDs(const JsonObject& parameters) { - LOGINFOMETHOD(); + LOG_INPARAM(); NMLOG_INFO("Posting onAvailableSSIDs"); if(_gWiFiInstance) @@ -632,7 +632,7 @@ namespace WPEFramework void WiFiManager::onWiFiSignalStrengthChange(const JsonObject& parameters) { - LOGINFOMETHOD(); + LOG_INPARAM(); JsonObject legacyParams; legacyParams["signalStrength"] = parameters["signalQuality"]; legacyParams["strength"] = parameters["signalLevel"]; diff --git a/NetworkManagerConnectivity.cpp b/NetworkManagerConnectivity.cpp index e75334d..e9cacd9 100644 --- a/NetworkManagerConnectivity.cpp +++ b/NetworkManagerConnectivity.cpp @@ -151,7 +151,6 @@ namespace WPEFramework curl_easy_setopt(curl_easy_handle, CURLOPT_USERAGENT, "RDKCaptiveCheck/1.0"); if(!headReq) { - // NMLOG_TRACE("curlopt get request"); /* HTTPGET request added insted of HTTPHEAD request fix for DELIA-61526 */ curl_easy_setopt(curl_easy_handle, CURLOPT_HTTPGET, 1L); } @@ -198,10 +197,9 @@ namespace WPEFramework if (CURLE_OK == msg->data.result) { if (curl_easy_getinfo(msg->easy_handle, CURLINFO_RESPONSE_CODE, &response_code) == CURLE_OK) { - //NMLOG_TRACE("endpoint = <%s> http response code <%d>", endpoint, static_cast(response_code)); if (HttpStatus_302_Found == response_code) { if ( (curl_easy_getinfo(msg->easy_handle, CURLINFO_REDIRECT_URL, &url) == CURLE_OK) && url != nullptr) { - NMLOG_TRACE("captive portal found !!!"); + NMLOG_INFO("captive portal found !!!"); captivePortalURI = url; } } @@ -239,7 +237,7 @@ namespace WPEFramework } if(curlVerboseEnabled()) { - NMLOG_TRACE("endpoints count = %d response count %d, handles = %d, deadline = %ld, time_now = %ld, time_earlier = %ld", + NMLOG_DEBUG("endpoints count = %d response count %d, handles = %d, deadline = %ld, time_now = %ld, time_earlier = %ld", static_cast(endpoints.size()), static_cast(http_responses.size()), handles, deadline, time_now, time_earlier); } @@ -481,7 +479,7 @@ namespace WPEFramework if (doConnectivityMonitor) { cvConnectivityMonitor.notify_one(); - NMLOG_TRACE("trigger connectivity monitor thread"); + NMLOG_DEBUG("trigger connectivity monitor thread"); return true; } @@ -526,7 +524,7 @@ namespace WPEFramework { if(doConnectivityMonitor) { - NMLOG_TRACE("connectivity monitor running so skiping ccm check"); + NMLOG_DEBUG("connectivity monitor running so skiping ccm check"); gIpv4InternetState = UNKNOWN; gIpv6InternetState = UNKNOWN; std::unique_lock lock(connMutex); @@ -621,7 +619,7 @@ namespace WPEFramework gIpv4InternetState = UNKNOWN; gIpv6InternetState = UNKNOWN; - NMLOG_TRACE("continous connectivity monitor exit"); + NMLOG_DEBUG("continous connectivity monitor exit"); } void ConnectivityMonitor::connectivityMonitorFunction() @@ -720,7 +718,7 @@ namespace WPEFramework if(!doContinuousMonitor) gInternetState = nsm_internetState::UNKNOWN; // no continous monitor running reset to unknow - NMLOG_TRACE("initial connectivity monitor exit"); + NMLOG_DEBUG("initial connectivity monitor exit"); } } // namespace Plugin diff --git a/NetworkManagerGnomeEvents.cpp b/NetworkManagerGnomeEvents.cpp index 6afd4f7..b7f1706 100644 --- a/NetworkManagerGnomeEvents.cpp +++ b/NetworkManagerGnomeEvents.cpp @@ -80,7 +80,7 @@ namespace WPEFramework } NMDeviceStateReason reason = nm_device_get_state_reason(device); std::string wifiState; - // NMLOG_TRACE("\033[0;31m NMDeviceStateReason %d \033[0m",reason); + // NMLOG_DEBUG("\033[0;31m NMDeviceStateReason %d \033[0m",reason); switch (reason) { case NM_DEVICE_STATE_REASON_SUPPLICANT_AVAILABLE: @@ -157,7 +157,7 @@ namespace WPEFramework } } } - NMLOG_TRACE("wifi state: %s", wifiState.c_str()); + NMLOG_DEBUG("wifi state: %s", wifiState.c_str()); } else if(ifname == nmEvents->ifnameEth0) { @@ -185,7 +185,7 @@ namespace WPEFramework } } - NMLOG_TRACE("%s state: (%d)", ifname.c_str(), deviceState); + NMLOG_DEBUG("%s state: (%d)", ifname.c_str(), deviceState); } @@ -295,7 +295,7 @@ namespace WPEFramework } } else - NMLOG_TRACE("device error null"); + NMLOG_DEBUG("device error null"); } static void deviceRemovedCB(NMClient *client, NMDevice *device, NMEvents *nmEvents) @@ -330,7 +330,7 @@ namespace WPEFramework NMLOG_WARNING("internet connection down"); break; case NM_STATE_CONNECTED_GLOBAL: - NMLOG_TRACE("global internet connection success"); + NMLOG_DEBUG("global internet connection success"); break; default: break; @@ -393,7 +393,7 @@ namespace WPEFramework } } else - NMLOG_TRACE("device type not eth/wifi"); + NMLOG_DEBUG("device type not eth/wifi"); } } @@ -405,7 +405,7 @@ namespace WPEFramework bool GnomeNetworkManagerEvents::startNetworkMangerEventMonitor() { - NMLOG_TRACE("starting gnome event monitor"); + NMLOG_DEBUG("starting gnome event monitor"); if (NULL == nmEvents.client) { NMLOG_ERROR("Client Connection NULL DBUS event Failed!"); return false; @@ -452,7 +452,7 @@ namespace WPEFramework GnomeNetworkManagerEvents::GnomeNetworkManagerEvents() { - NMLOG_TRACE("GnomeNetworkManagerEvents"); + NMLOG_DEBUG("GnomeNetworkManagerEvents"); std::string wifiInterface = "wlan0", ethernetInterface = "eth0"; if(!nmUtils::GetInterfacesName(wifiInterface, ethernetInterface)) { @@ -523,7 +523,7 @@ namespace WPEFramework default: state = "Unknown"; } - NMLOG_TRACE("%s interface state changed - %s", iface.c_str(), state.c_str()); + NMLOG_DEBUG("%s interface state changed - %s", iface.c_str(), state.c_str()); if(_instance != nullptr && (iface == _nmEventInstance->nmEvents.ifnameWlan0 || iface == _nmEventInstance->nmEvents.ifnameEth0)) _instance->ReportInterfaceStateChangedEvent(static_cast(newState), iface); } @@ -570,7 +570,7 @@ namespace WPEFramework void GnomeNetworkManagerEvents::onAvailableSSIDsCb(NMDeviceWifi *wifiDevice, GParamSpec *pspec, gpointer userData) { - NMLOG_TRACE("wifi scanning completed ..."); + NMLOG_DEBUG("wifi scanning completed ..."); if(!NM_IS_DEVICE_WIFI(wifiDevice)) { NMLOG_ERROR("Not a wifi object "); @@ -592,7 +592,7 @@ namespace WPEFramework if(_nmEventInstance->debugLogs) { _nmEventInstance->debugLogs = false; NMLOG_INFO("Number of Access Points Available = %d", static_cast(accessPoints->len)); - NMLOG_TRACE("Scanned APIs are = %s",ssidListJson.c_str()); + NMLOG_DEBUG("Scanned APIs are = %s",ssidListJson.c_str()); } if(_nmEventInstance->doScanNotify) { @@ -606,7 +606,7 @@ namespace WPEFramework doScanNotify.store(doNotify); if(!doScanNotify) { - NMLOG_TRACE("stop periodic wifi scan result notify"); + NMLOG_DEBUG("stop periodic wifi scan result notify"); } debugLogs = enableLogs; } diff --git a/NetworkManagerGnomeProxy.cpp b/NetworkManagerGnomeProxy.cpp index 5104d2e..f069bc9 100644 --- a/NetworkManagerGnomeProxy.cpp +++ b/NetworkManagerGnomeProxy.cpp @@ -34,7 +34,7 @@ namespace WPEFramework // initialize the NMClient object client = nm_client_new(NULL, &error); if (client == NULL) { - NMLOG_TRACE("Error initializing NMClient: %s", error->message); + NMLOG_DEBUG("Error initializing NMClient: %s", error->message); g_error_free(error); return; } @@ -125,7 +125,7 @@ namespace WPEFramework interface = ifacePtr; if(interface != "eth0" && interface != "wlan0") { - NMLOG_TRACE("interface name is unknow"); + NMLOG_DEBUG("interface name is unknow"); interface.clear(); } else @@ -250,7 +250,7 @@ namespace WPEFramework if (g_strcmp0(name, interface.c_str()) == 0) { nm_device_set_managed(device, false); - NMLOG_TRACE("Interface %s status set to disabled", + NMLOG_DEBUG("Interface %s status set to disabled", interface.c_str()); } } @@ -388,7 +388,7 @@ namespace WPEFramework for (i = 0; i < p->len; i++) { a = static_cast(p->pdata[i]); result.m_ipAddress = nm_ip_address_get_address(a); - NMLOG_TRACE("\tinet6 %s/%d\n", nm_ip_address_get_address(a), nm_ip_address_get_prefix(a)); + NMLOG_DEBUG("\tinet6 %s/%d\n", nm_ip_address_get_address(a), nm_ip_address_get_prefix(a)); } gateway = nm_ip_config_get_gateway(ip6_config); @@ -421,10 +421,10 @@ namespace WPEFramework // Check if the operation was successful if (!nm_client_deactivate_connection_finish(NM_CLIENT(source_object), res, &error)) { - NMLOG_TRACE("Deactivating connection failed: %s", error->message); + NMLOG_DEBUG("Deactivating connection failed: %s", error->message); g_error_free(error); } else { - NMLOG_TRACE("Deactivating connection successful"); + NMLOG_DEBUG("Deactivating connection successful"); } } @@ -434,10 +434,10 @@ namespace WPEFramework // Check if the operation was successful if (!nm_client_activate_connection_finish(NM_CLIENT(source_object), res, &error)) { - NMLOG_TRACE("Activating connection failed: %s", error->message); + NMLOG_DEBUG("Activating connection failed: %s", error->message); g_error_free(error); } else { - NMLOG_TRACE("Activating connection successful"); + NMLOG_DEBUG("Activating connection successful"); } g_main_loop_quit((GMainLoop*)user_data); diff --git a/NetworkManagerGnomeUtils.cpp b/NetworkManagerGnomeUtils.cpp index 8e611b0..e536839 100644 --- a/NetworkManagerGnomeUtils.cpp +++ b/NetworkManagerGnomeUtils.cpp @@ -73,19 +73,19 @@ namespace WPEFramework switch(flags) { case NM_802_11_AP_FLAGS_NONE: - NMLOG_TRACE("ap type : point has no special capabilities"); + NMLOG_DEBUG("ap type : point has no special capabilities"); break; case NM_802_11_AP_FLAGS_PRIVACY: - NMLOG_TRACE("ap type : access point requires authentication and encryption"); + NMLOG_DEBUG("ap type : access point requires authentication and encryption"); break; case NM_802_11_AP_FLAGS_WPS: - NMLOG_TRACE("ap type : access point supports some WPS method"); + NMLOG_DEBUG("ap type : access point supports some WPS method"); break; case NM_802_11_AP_FLAGS_WPS_PBC: - NMLOG_TRACE("ap type : access point supports push-button WPS"); + NMLOG_DEBUG("ap type : access point supports push-button WPS"); break; case NM_802_11_AP_FLAGS_WPS_PIN: - NMLOG_TRACE("ap type : access point supports PIN-based WPS"); + NMLOG_DEBUG("ap type : access point supports PIN-based WPS"); break; default: NMLOG_ERROR("ap type : 802.11 flags unknown!"); diff --git a/NetworkManagerGnomeWIFI.cpp b/NetworkManagerGnomeWIFI.cpp index 4d45820..497f567 100644 --- a/NetworkManagerGnomeWIFI.cpp +++ b/NetworkManagerGnomeWIFI.cpp @@ -121,7 +121,7 @@ namespace WPEFramework if (nm_device_get_device_type(device) == NM_DEVICE_TYPE_WIFI) { wifiDevice = device; - //NMLOG_TRACE("Wireless Device found ifce : %s !", nm_device_get_iface (wifiDevice)); + //NMLOG_DEBUG("Wireless Device found ifce : %s !", nm_device_get_iface (wifiDevice)); break; } } @@ -204,37 +204,37 @@ namespace WPEFramework else { wifiInfo.m_ssid = "-----"; - NMLOG_TRACE("ssid: %s", wifiInfo.m_ssid.c_str()); + NMLOG_DEBUG("ssid: %s", wifiInfo.m_ssid.c_str()); } wifiInfo.m_bssid = (hwaddr != nullptr) ? hwaddr : "-----"; - NMLOG_TRACE("bssid: %s", wifiInfo.m_bssid.c_str()); + NMLOG_DEBUG("bssid: %s", wifiInfo.m_bssid.c_str()); if (freq >= 2400 && freq < 5000) { wifiInfo.m_frequency = Exchange::INetworkManager::WiFiFrequency::WIFI_FREQUENCY_2_4_GHZ; - NMLOG_TRACE("freq: WIFI_FREQUENCY_2_4_GHZ"); + NMLOG_DEBUG("freq: WIFI_FREQUENCY_2_4_GHZ"); } else if (freq >= 5000 && freq < 6000) { wifiInfo.m_frequency = Exchange::INetworkManager::WiFiFrequency::WIFI_FREQUENCY_5_GHZ; - NMLOG_TRACE("freq: WIFI_FREQUENCY_5_GHZ"); + NMLOG_DEBUG("freq: WIFI_FREQUENCY_5_GHZ"); } else if (freq >= 6000) { wifiInfo.m_frequency = Exchange::INetworkManager::WiFiFrequency::WIFI_FREQUENCY_6_GHZ; - NMLOG_TRACE("freq: WIFI_FREQUENCY_6_GHZ"); + NMLOG_DEBUG("freq: WIFI_FREQUENCY_6_GHZ"); } else { wifiInfo.m_frequency = Exchange::INetworkManager::WiFiFrequency::WIFI_FREQUENCY_WHATEVER; - NMLOG_TRACE("freq: No available !"); + NMLOG_DEBUG("freq: No available !"); } wifiInfo.m_rate = std::to_string(bitrate); - NMLOG_TRACE("bitrate : %s kbit/s", wifiInfo.m_rate.c_str()); + NMLOG_DEBUG("bitrate : %s kbit/s", wifiInfo.m_rate.c_str()); //TODO signal strenght to dBm wifiInfo.m_signalStrength = std::to_string(static_cast(strength)); - NMLOG_TRACE("sterngth: %s %%", wifiInfo.m_signalStrength.c_str()); + NMLOG_DEBUG("sterngth: %s %%", wifiInfo.m_signalStrength.c_str()); wifiInfo.m_securityMode = static_cast(nmUtils::wifiSecurityModeFromAp(flags, wpaFlags, rsnFlags)); - NMLOG_TRACE("security %s", nmUtils::getSecurityModeString(flags, wpaFlags, rsnFlags).c_str()); - NMLOG_TRACE("Mode: %s", mode == NM_802_11_MODE_ADHOC ? "Ad-Hoc": mode == NM_802_11_MODE_INFRA ? "Infrastructure": "Unknown"); + NMLOG_DEBUG("security %s", nmUtils::getSecurityModeString(flags, wpaFlags, rsnFlags).c_str()); + NMLOG_DEBUG("Mode: %s", mode == NM_802_11_MODE_ADHOC ? "Ad-Hoc": mode == NM_802_11_MODE_INFRA ? "Infrastructure": "Unknown"); } bool wifiManager::isWifiConnected() @@ -244,7 +244,7 @@ namespace WPEFramework NMDeviceWifi *wifiDevice = NM_DEVICE_WIFI(getNmDevice()); if(wifiDevice == NULL) { - NMLOG_TRACE("NMDeviceWifi * NULL !"); + NMLOG_DEBUG("NMDeviceWifi * NULL !"); return false; } @@ -254,7 +254,7 @@ namespace WPEFramework return false; } else - NMLOG_TRACE("active access point found !"); + NMLOG_DEBUG("active access point found !"); return true; } @@ -265,7 +265,7 @@ namespace WPEFramework NMDeviceWifi *wifiDevice = NM_DEVICE_WIFI(getNmDevice()); if(wifiDevice == NULL) { - NMLOG_TRACE("NMDeviceWifi * NULL !"); + NMLOG_DEBUG("NMDeviceWifi * NULL !"); return false; } @@ -275,7 +275,7 @@ namespace WPEFramework return false; } else - NMLOG_TRACE("active access point found !"); + NMLOG_DEBUG("active access point found !"); getApInfo(activeAP, ssidinfo); return true; @@ -287,7 +287,7 @@ namespace WPEFramework GError *error = NULL; wifiManager *_wifiManager = (static_cast(user_data)); - NMLOG_TRACE("Disconnecting... "); + NMLOG_DEBUG("Disconnecting... "); _wifiManager->isSuccess = true; if (!nm_device_disconnect_finish(device, result, &error)) { if (g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) @@ -311,13 +311,13 @@ namespace WPEFramework NMDevice *wifiNMDevice = getNmDevice(); if(wifiNMDevice == NULL) { - NMLOG_TRACE("NMDeviceWifi NULL !"); + NMLOG_DEBUG("NMDeviceWifi NULL !"); return false; } nm_device_disconnect_async(wifiNMDevice, NULL, wifiDisconnectCb, this); wait(loop); - NMLOG_TRACE("Exit"); + NMLOG_DEBUG("Exit"); return isSuccess; } @@ -338,7 +338,7 @@ namespace WPEFramework const guint8 *ssidData = static_cast(g_bytes_get_data(ssidGBytes, &size)); std::string ssidstr(reinterpret_cast(ssidData), size); //g_bytes_unref(ssidGBytes); - // NMLOG_TRACE("ssid < %s >", ssidstr.c_str()); + // NMLOG_DEBUG("ssid < %s >", ssidstr.c_str()); if (strcmp(ssid, ssidstr.c_str()) == 0) { AccessPoint = candidate_ap; @@ -356,12 +356,12 @@ namespace WPEFramework wifiManager *_wifiManager = (static_cast(user_data)); if (_wifiManager->createNewConnection) { - NMLOG_TRACE("nm_client_add_and_activate_connection_finish"); + NMLOG_DEBUG("nm_client_add_and_activate_connection_finish"); nm_client_add_and_activate_connection_finish(NM_CLIENT(_wifiManager->client), result, &error); _wifiManager->isSuccess = true; } else { - NMLOG_TRACE("nm_client_activate_connection_finish "); + NMLOG_DEBUG("nm_client_activate_connection_finish "); nm_client_activate_connection_finish(NM_CLIENT(_wifiManager->client), result, &error); _wifiManager->isSuccess = true; } @@ -447,7 +447,7 @@ namespace WPEFramework NMLOG_WARNING("wifi already connected with %s AP", activeSSID.c_str()); } } - //NMLOG_TRACE("Wireless Device found ifce : %s !", ifname = nm_device_get_iface(device)); + //NMLOG_DEBUG("Wireless Device found ifce : %s !", ifname = nm_device_get_iface(device)); AccessPoint = checkSSIDAvailable(device, allaps, ssid_in); // TODO Scann hidden ssid also for lnf if(AccessPoint == NULL) { @@ -473,7 +473,7 @@ namespace WPEFramework if (nm_access_point_connection_valid(AccessPoint, NM_CONNECTION(currentConnection))) { connection = g_object_ref(currentConnection); - NMLOG_TRACE("Connection '%s' exists !", conName); + NMLOG_DEBUG("Connection '%s' exists !", conName); break; } } @@ -487,7 +487,7 @@ namespace WPEFramework if (!connection) { - NMLOG_TRACE("creating new connection '%s' ", conName); + NMLOG_DEBUG("creating new connection '%s' ", conName); connection = nm_simple_connection_new(); if (conName) { sConnection = (NMSettingConnection *) nm_setting_connection_new(); @@ -542,11 +542,11 @@ namespace WPEFramework GError *error = NULL; NMLOG_INFO("Ap securtity mode is 802.1X"); - NMLOG_TRACE("802.1x Identity : %s", wifiData.m_identity.c_str()); - NMLOG_TRACE("802.1x CA cert path : %s", wifiData.m_caCert.c_str()); - NMLOG_TRACE("802.1x Client cert path : %s", wifiData.m_clientCert.c_str()); - NMLOG_TRACE("802.1x Private key path : %s", wifiData.m_privateKey.c_str()); - NMLOG_TRACE("802.1x Private key psswd : %s", wifiData.m_privateKeyPasswd.c_str()); + NMLOG_DEBUG("802.1x Identity : %s", wifiData.m_identity.c_str()); + NMLOG_DEBUG("802.1x CA cert path : %s", wifiData.m_caCert.c_str()); + NMLOG_DEBUG("802.1x Client cert path : %s", wifiData.m_clientCert.c_str()); + NMLOG_DEBUG("802.1x Private key path : %s", wifiData.m_privateKey.c_str()); + NMLOG_DEBUG("802.1x Private key psswd : %s", wifiData.m_privateKeyPasswd.c_str()); s8021X = (NMSetting8021x *) nm_setting_802_1x_new(); nm_connection_add_setting(connection, NM_SETTING(s8021X)); @@ -665,7 +665,7 @@ namespace WPEFramework } else { - NMLOG_TRACE ("AddToKnownSSIDs is success"); + NMLOG_DEBUG ("AddToKnownSSIDs is success"); _wifiManager->isSuccess = true; } @@ -829,7 +829,7 @@ namespace WPEFramework } if (!ssids.empty()) { - NMLOG_TRACE("known wifi connections are %s", ssidPrint.c_str()); + NMLOG_DEBUG("known wifi connections are %s", ssidPrint.c_str()); return true; } @@ -841,7 +841,7 @@ namespace WPEFramework GError *error = NULL; wifiManager *_wifiManager = (static_cast(user_data)); if(nm_device_wifi_request_scan_finish(NM_DEVICE_WIFI(object), result, &error)) { - NMLOG_TRACE("Scanning success"); + NMLOG_DEBUG("Scanning success"); _wifiManager->isSuccess = true; } else @@ -864,7 +864,7 @@ namespace WPEFramework return false; NMDeviceWifi *wifiDevice = NM_DEVICE_WIFI(getNmDevice()); if(wifiDevice == NULL) { - NMLOG_TRACE("NMDeviceWifi * NULL !"); + NMLOG_DEBUG("NMDeviceWifi * NULL !"); return false; } isSuccess = false; @@ -884,7 +884,7 @@ namespace WPEFramework nm_device_wifi_request_scan_options_async(wifiDevice, options, NULL, wifiScanCb, this); } else { - NMLOG_TRACE("staring normal wifi scanning"); + NMLOG_DEBUG("staring normal wifi scanning"); nm_device_wifi_request_scan_async(wifiDevice, NULL, wifiScanCb, this); } wait(loop); @@ -911,14 +911,14 @@ namespace WPEFramework gint64 current_time_in_msec = nm_utils_get_timestamp_msec(); gint64 time_difference_in_seconds = (current_time_in_msec - last_scan_time) / 1000; - NMLOG_TRACE("Current time in milliseconds: %" G_GINT64_FORMAT, current_time_in_msec); - NMLOG_TRACE("Last scan time in milliseconds: %" G_GINT64_FORMAT, last_scan_time); - NMLOG_TRACE("Time difference in seconds: %" G_GINT64_FORMAT, time_difference_in_seconds); + NMLOG_DEBUG("Current time in milliseconds: %" G_GINT64_FORMAT, current_time_in_msec); + NMLOG_DEBUG("Last scan time in milliseconds: %" G_GINT64_FORMAT, last_scan_time); + NMLOG_DEBUG("Time difference in seconds: %" G_GINT64_FORMAT, time_difference_in_seconds); if (time_difference_in_seconds <= timelimitInSec) { return true; } - NMLOG_TRACE("Last Wi-Fi scan exceeded time limit."); + NMLOG_DEBUG("Last Wi-Fi scan exceeded time limit."); return false; } diff --git a/NetworkManagerImplementation.cpp b/NetworkManagerImplementation.cpp index 6c48857..7315ca0 100644 --- a/NetworkManagerImplementation.cpp +++ b/NetworkManagerImplementation.cpp @@ -108,7 +108,7 @@ namespace WPEFramework return(Core::ERROR_GENERAL); } - NMLOG_TRACE("config line : %s", configLine.c_str()); + NMLOG_DEBUG("config line : %s", configLine.c_str()); Config config; if(config.FromString(configLine)) @@ -118,11 +118,11 @@ namespace WPEFramework m_stunPort = config.stun.port.Value(); m_stunBindTimeout = config.stun.interval.Value(); - NMLOG_TRACE("config : stun endpoint %s", m_stunEndPoint.c_str()); - NMLOG_TRACE("config : stun port %d", m_stunPort); - NMLOG_TRACE("config : stun interval %d", m_stunBindTimeout); + NMLOG_DEBUG("config : stun endpoint %s", m_stunEndPoint.c_str()); + NMLOG_DEBUG("config : stun port %d", m_stunPort); + NMLOG_DEBUG("config : stun interval %d", m_stunBindTimeout); - NMLOG_TRACE("config : loglevel %d", config.loglevel.Value()); + NMLOG_DEBUG("config : loglevel %d", config.loglevel.Value()); logLevel = static_cast (config.loglevel.Value()); // configure loglevel in libWPEFrameworkNetworkManagerImplementation.so NetworkManagerLogger::SetLevel(static_cast (logLevel)); @@ -130,23 +130,23 @@ namespace WPEFramework /* load connectivity monitor endpoints */ std::vector connectEndpts; if(!config.connectivityConf.endpoint_1.Value().empty()) { - NMLOG_TRACE("config : connectivity enpt 1 %s", config.connectivityConf.endpoint_1.Value().c_str()); + NMLOG_DEBUG("config : connectivity enpt 1 %s", config.connectivityConf.endpoint_1.Value().c_str()); connectEndpts.push_back(config.connectivityConf.endpoint_1.Value().c_str()); } if(!config.connectivityConf.endpoint_2.Value().empty()) { - NMLOG_TRACE("config : connectivity enpt 2 %s", config.connectivityConf.endpoint_2.Value().c_str()); + NMLOG_DEBUG("config : connectivity enpt 2 %s", config.connectivityConf.endpoint_2.Value().c_str()); connectEndpts.push_back(config.connectivityConf.endpoint_2.Value().c_str()); } if(!config.connectivityConf.endpoint_3.Value().empty()) { - NMLOG_TRACE("config : connectivity enpt 3 %s", config.connectivityConf.endpoint_3.Value().c_str()); + NMLOG_DEBUG("config : connectivity enpt 3 %s", config.connectivityConf.endpoint_3.Value().c_str()); connectEndpts.push_back(config.connectivityConf.endpoint_3.Value().c_str()); } if(!config.connectivityConf.endpoint_4.Value().empty()) { - NMLOG_TRACE("config : connectivity enpt 4 %s", config.connectivityConf.endpoint_4.Value().c_str()); + NMLOG_DEBUG("config : connectivity enpt 4 %s", config.connectivityConf.endpoint_4.Value().c_str()); connectEndpts.push_back(config.connectivityConf.endpoint_4.Value().c_str()); } if(!config.connectivityConf.endpoint_5.Value().empty()) { - NMLOG_TRACE("config : connectivity enpt 5 %s", config.connectivityConf.endpoint_5.Value().c_str()); + NMLOG_DEBUG("config : connectivity enpt 5 %s", config.connectivityConf.endpoint_5.Value().c_str()); connectEndpts.push_back(config.connectivityConf.endpoint_5.Value().c_str()); } @@ -300,7 +300,7 @@ namespace WPEFramework snprintf(cmd, sizeof(cmd), "ping -c %d -W %d '%s' 2>&1", noOfRequest, timeOutInSeconds, endpoint.c_str()); } - NMLOG_TRACE ("The Command is %s", cmd); + NMLOG_DEBUG ("The Command is %s", cmd); string commandToExecute(cmd); executeExternally(NETMGR_PING, commandToExecute, response); @@ -321,7 +321,7 @@ namespace WPEFramework snprintf(cmd, 256, "traceroute -w 3 -m 6 -q %d %s 52 2>&1", noOfRequest, endpoint.c_str()); } - NMLOG_TRACE ("The Command is %s", cmd); + NMLOG_DEBUG ("The Command is %s", cmd); string commandToExecute(cmd); executeExternally(NETMGR_TRACE, commandToExecute, tempResult); diff --git a/NetworkManagerImplementation.h b/NetworkManagerImplementation.h index 9c86b69..8c98390 100644 --- a/NetworkManagerImplementation.h +++ b/NetworkManagerImplementation.h @@ -35,7 +35,7 @@ using namespace std; #include "NetworkManagerConnectivity.h" #include "NetworkManagerStunClient.h" -#define LOG_ENTRY_FUNCTION() { NMLOG_TRACE("Entering=%s", __FUNCTION__ ); } +#define LOG_ENTRY_FUNCTION() { NMLOG_DEBUG("Entering=%s", __FUNCTION__ ); } namespace WPEFramework { diff --git a/NetworkManagerJsonRpc.cpp b/NetworkManagerJsonRpc.cpp index c4ada38..a99978e 100644 --- a/NetworkManagerJsonRpc.cpp +++ b/NetworkManagerJsonRpc.cpp @@ -19,8 +19,8 @@ #include "NetworkManager.h" -#define LOGINFOMETHOD() { std::string json; parameters.ToString(json); NMLOG_TRACE("params=%s", json.c_str() ); } -#define LOGTRACEMETHODFIN() { std::string json; response.ToString(json); NMLOG_TRACE("response=%s", json.c_str() ); } +#define LOG_INPARAM() { string json; parameters.ToString(json); NMLOG_DEBUG("%s : params=%s", __FUNCTION__, json.c_str() ); } +#define LOG_OUTPARAM() { string json; response.ToString(json); NMLOG_INFO("%s : response=%s", __FUNCTION__, json.c_str() ); } using namespace NetworkManagerLogger; @@ -114,7 +114,7 @@ namespace WPEFramework uint32_t NetworkManager::SetLogLevel (const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; LogLevel level = INFO_LEVEL; @@ -134,13 +134,13 @@ namespace WPEFramework { response["success"] = true; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t NetworkManager::GetAvailableInterfaces (const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; Exchange::INetworkManager::IInterfaceDetailsIterator* interfaces = NULL; @@ -151,7 +151,7 @@ namespace WPEFramework if (interfaces) { - NMLOG_TRACE("received response"); + NMLOG_DEBUG("received response"); JsonArray array; Exchange::INetworkManager::InterfaceDetails entry{}; while (interfaces->Next(entry) == true) { @@ -166,17 +166,17 @@ namespace WPEFramework } interfaces->Release(); - NMLOG_TRACE("Sending Success"); + NMLOG_DEBUG("Sending Success"); response["interfaces"] = array; response["success"] = true; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t NetworkManager::GetPrimaryInterface (const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; string interface; if (_networkManager) @@ -190,13 +190,13 @@ namespace WPEFramework m_defaultInterface = interface; response["success"] = true; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t NetworkManager::SetPrimaryInterface (const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; string interface = parameters["interface"].String(); @@ -215,13 +215,13 @@ namespace WPEFramework { response["success"] = true; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t NetworkManager::SetInterfaceState(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; string interface = parameters["interface"].String(); bool enabled = parameters["enabled"].Boolean(); @@ -241,13 +241,13 @@ namespace WPEFramework { response["success"] = true; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t NetworkManager::GetInterfaceState(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; bool isEnabled = false; string interface = parameters["interface"].String(); @@ -268,13 +268,13 @@ namespace WPEFramework response["enabled"] = isEnabled; response["success"] = true; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t NetworkManager::GetIPSettings (const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; string interface = ""; string ipversion = ""; @@ -316,13 +316,13 @@ namespace WPEFramework response["secondarydns"] = result.m_secondaryDns; response["success"] = true; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t NetworkManager::SetIPSettings(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; Exchange::INetworkManager::IPAddressInfo result{}; string interface = ""; @@ -358,13 +358,13 @@ namespace WPEFramework { response["success"] = true; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t NetworkManager::GetStunEndpoint(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; string endPoint; uint32_t port; @@ -384,13 +384,13 @@ namespace WPEFramework response["cacheTimeout"] = cacheTimeout; response["success"] = true; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t NetworkManager::SetStunEndpoint(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; string endPoint = parameters["endPoint"].String(); uint32_t port = parameters["port"].Number(); @@ -406,13 +406,13 @@ namespace WPEFramework { response["success"] = true; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t NetworkManager::GetConnectivityTestEndpoints(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; Exchange::INetworkManager::IStringIterator* endpoints = NULL; @@ -437,20 +437,20 @@ namespace WPEFramework response["success"] = true; } } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t NetworkManager::SetConnectivityTestEndpoints(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; ::WPEFramework::RPC::IIteratorType* endpointsIter{}; JsonArray array = parameters["endpoints"].Array(); if (0 == array.Length() || 5 < array.Length()) { - NMLOG_TRACE("minimum of 1 to maximum of 5 Urls are allowed"); + NMLOG_DEBUG("minimum of 1 to maximum of 5 Urls are allowed"); return rc; } @@ -464,7 +464,7 @@ namespace WPEFramework } else { - NMLOG_TRACE("Unexpected variant type"); + NMLOG_DEBUG("Unexpected variant type"); return rc; } } @@ -483,13 +483,13 @@ namespace WPEFramework if (endpointsIter) endpointsIter->Release(); - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t NetworkManager::IsConnectedToInternet(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; string ipversion = parameters["ipversion"].String(); Exchange::INetworkManager::InternetStatus result; @@ -524,13 +524,13 @@ namespace WPEFramework response["success"] = true; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t NetworkManager::GetCaptivePortalURI(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; string endPoint; if (_networkManager) @@ -543,17 +543,17 @@ namespace WPEFramework response["uri"] = endPoint; response["success"] = true; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t NetworkManager::StartConnectivityMonitoring(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; uint32_t interval = parameters["interval"].Number(); - NMLOG_TRACE("connectivity interval = %d", interval); + NMLOG_DEBUG("connectivity interval = %d", interval); if (_networkManager) rc = _networkManager->StartConnectivityMonitoring(interval); else @@ -563,13 +563,13 @@ namespace WPEFramework { response["success"] = true; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t NetworkManager::StopConnectivityMonitoring(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; if (_networkManager) @@ -581,13 +581,13 @@ namespace WPEFramework { response["success"] = true; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t NetworkManager::GetPublicIP(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; string ipAddress{}; string ipversion = "IPv4"; @@ -617,13 +617,13 @@ namespace WPEFramework m_publicIPAddressType = ipversion; PublishToThunderAboutInternet(); } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } void NetworkManager::PublishToThunderAboutInternet() { - NMLOG_TRACE("No public IP persisted yet; Update the data"); + NMLOG_DEBUG("No public IP persisted yet; Update the data"); if (m_publicIPAddress.empty()) { JsonObject input, output; @@ -650,9 +650,10 @@ namespace WPEFramework uint32_t NetworkManager::Ping(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); string result{}; uint32_t rc = Core::ERROR_GENERAL; + LOG_INPARAM(); if (parameters.HasLabel("endpoint")) { string endpoint{}; @@ -687,13 +688,13 @@ namespace WPEFramework reply.FromString(result); response = reply; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t NetworkManager::Trace(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; string result{}; const string ipversion = parameters["ipversion"].String(); @@ -713,13 +714,13 @@ namespace WPEFramework reply["success"] = true; response = reply; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t NetworkManager::StartWiFiScan(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; const Exchange::INetworkManager::WiFiFrequency frequency = static_cast (parameters["frequency"].Number()); @@ -732,13 +733,13 @@ namespace WPEFramework { response["success"] = true; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t NetworkManager::StopWiFiScan(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; if (_networkManager) @@ -750,13 +751,13 @@ namespace WPEFramework { response["success"] = true; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t NetworkManager::GetKnownSSIDs(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; JsonArray ssids; @@ -781,13 +782,13 @@ namespace WPEFramework response["ssids"] = ssids; response["success"] = true; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t NetworkManager::AddToKnownSSIDs(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; Exchange::INetworkManager::WiFiConnectTo ssid{}; @@ -807,13 +808,13 @@ namespace WPEFramework { response["success"] = true; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t NetworkManager::RemoveKnownSSID(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; string ssid{}; @@ -830,13 +831,13 @@ namespace WPEFramework { response["success"] = true; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t NetworkManager::WiFiConnect(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; Exchange::INetworkManager::WiFiConnectTo ssid{}; @@ -870,13 +871,13 @@ namespace WPEFramework { response["success"] = true; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t NetworkManager::WiFiDisconnect(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; if (_networkManager) @@ -888,13 +889,13 @@ namespace WPEFramework { response["success"] = true; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t NetworkManager::GetConnectedSSID(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; Exchange::INetworkManager::WiFiSSIDInfo ssidInfo{}; @@ -914,13 +915,13 @@ namespace WPEFramework response["noise"] = ssidInfo.m_noise; response["success"] = true; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t NetworkManager::StartWPS(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; string wps_pin{}; Exchange::INetworkManager::WiFiWPS method; @@ -946,13 +947,13 @@ namespace WPEFramework { response["success"] = true; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t NetworkManager::StopWPS(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; if (_networkManager) @@ -964,7 +965,7 @@ namespace WPEFramework { response["success"] = true; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } @@ -973,7 +974,7 @@ namespace WPEFramework Exchange::INetworkManager::WiFiState state; uint32_t rc = Core::ERROR_GENERAL; - LOGINFOMETHOD(); + LOG_INPARAM(); if (_networkManager) rc = _networkManager->GetWifiState(state); else @@ -983,13 +984,13 @@ namespace WPEFramework response["state"] = static_cast (state); response["success"] = true; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t NetworkManager::GetWiFiSignalStrength(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; string ssid{}; string signalStrength{}; @@ -1007,13 +1008,13 @@ namespace WPEFramework response["quality"] = static_cast (quality); response["success"] = true; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } uint32_t NetworkManager::GetSupportedSecurityModes(const JsonObject& parameters, JsonObject& response) { - LOGINFOMETHOD(); + LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; Exchange::INetworkManager::ISecurityModeIterator* securityModes{}; @@ -1036,7 +1037,7 @@ namespace WPEFramework } response["success"] = true; } - LOGTRACEMETHODFIN(); + LOG_OUTPARAM(); return rc; } } diff --git a/NetworkManagerLogger.cpp b/NetworkManagerLogger.cpp index 0b11831..faeab4b 100644 --- a/NetworkManagerLogger.cpp +++ b/NetworkManagerLogger.cpp @@ -36,6 +36,33 @@ namespace NetworkManagerLogger { static LogLevel gDefaultLogLevel = INFO_LEVEL; + +#ifdef USE_RDK_LOGGER + rdk_LogLevel mapTordkLogLevel(LogLevel level) + { + rdk_LogLevel rdklevel = RDK_LOG_INFO; + switch (level) + { + case FATAL_LEVEL: + rdklevel = RDK_LOG_FATAL; + break; + case ERROR_LEVEL: + rdklevel = RDK_LOG_ERROR; + break; + case WARNING_LEVEL: + rdklevel = RDK_LOG_WARN; + break; + case INFO_LEVEL: + rdklevel = RDK_LOG_INFO; + break; + case DEBUG_LEVEL: + rdklevel = RDK_LOG_DEBUG; + break; + } + return rdklevel; + } +#endif + const char* methodName(const std::string& prettyFunction) { size_t colons = prettyFunction.find("::"); @@ -72,9 +99,9 @@ namespace NetworkManagerLogger { } formattedLog[kFormatMessageSize - 1] = '\0'; #ifdef USE_RDK_LOGGER - RDK_LOG(static_cast(level), "LOG.RDK.NETMGR", "%s\n", formattedLog); + RDK_LOG(mapTordkLogLevel(level), "LOG.RDK.NWMGR", "%s\n", formattedLog); #else - const char* levelMap[] = {"Fatal", "Error", "Warning", "Info", "Verbose", "Trace"}; + const char* levelMap[] = {"Fatal", "Error", "Warn", "Info", "Debug"}; struct timeval tv; struct tm* lt; @@ -84,7 +111,7 @@ namespace NetworkManagerLogger { gettimeofday(&tv, NULL); lt = localtime(&tv.tv_sec); - printf("%.2d:%.2d:%.2d.%.6lld %-10s %s:%d : %s\n", lt->tm_hour, lt->tm_min, lt->tm_sec, (long long int)tv.tv_usec, levelMap[level], basename(file), line, formattedLog); + printf("%.2d:%.2d:%.2d.%.6lld [%-5s] [PID=%d] [TID=%d] %s : %s\n", lt->tm_hour, lt->tm_min, lt->tm_sec, (long long int)tv.tv_usec, levelMap[level], getpid(), gettid(), func, formattedLog); fflush(stdout); #endif } diff --git a/NetworkManagerLogger.h b/NetworkManagerLogger.h index 2441c99..65014d7 100644 --- a/NetworkManagerLogger.h +++ b/NetworkManagerLogger.h @@ -30,11 +30,11 @@ namespace NetworkManagerLogger { /** * Logging level with an increasing order of refinement - * (TRACE_LEVEL = Finest logging) + * (DEBUG_LEVEL = Finest logging) * It is essental to start with 0 and increase w/o gaps as the value * can be used for indexing in a mapping table. */ -enum LogLevel {FATAL_LEVEL = 0, ERROR_LEVEL, WARNING_LEVEL, INFO_LEVEL, VERBOSE_LEVEL, TRACE_LEVEL}; +enum LogLevel {FATAL_LEVEL = 0, ERROR_LEVEL, WARNING_LEVEL, INFO_LEVEL, DEBUG_LEVEL}; /** * @brief Init logging @@ -55,8 +55,7 @@ void SetLevel(LogLevel level); void logPrint(LogLevel level, const char* file, const char* func, int line, const char* format, ...) __attribute__ ((format (printf, 5, 6))); -#define NMLOG_TRACE(FMT, ...) logPrint(NetworkManagerLogger::TRACE_LEVEL, __FILE__, __func__, __LINE__, FMT, ##__VA_ARGS__) -#define NMLOG_VERBOSE(FMT, ...) logPrint(NetworkManagerLogger::VERBOSE_LEVEL, __FILE__, __func__, __LINE__, FMT, ##__VA_ARGS__) +#define NMLOG_DEBUG(FMT, ...) logPrint(NetworkManagerLogger::DEBUG_LEVEL, __FILE__, __func__, __LINE__, FMT, ##__VA_ARGS__) #define NMLOG_INFO(FMT, ...) logPrint(NetworkManagerLogger::INFO_LEVEL, __FILE__, __func__, __LINE__, FMT, ##__VA_ARGS__) #define NMLOG_WARNING(FMT, ...) logPrint(NetworkManagerLogger::WARNING_LEVEL, __FILE__, __func__, __LINE__, FMT, ##__VA_ARGS__) #define NMLOG_ERROR(FMT, ...) logPrint(NetworkManagerLogger::ERROR_LEVEL, __FILE__, __func__, __LINE__, FMT, ##__VA_ARGS__) diff --git a/NetworkManagerRDKProxy.cpp b/NetworkManagerRDKProxy.cpp index 9fd5ffd..d827213 100644 --- a/NetworkManagerRDKProxy.cpp +++ b/NetworkManagerRDKProxy.cpp @@ -763,7 +763,7 @@ namespace WPEFramework if (IARM_RESULT_SUCCESS == IARM_Bus_Call (IARM_BUS_NM_SRV_MGR_NAME, IARM_BUS_NETSRVMGR_API_isInterfaceEnabled, (void *)&iarmData, sizeof(iarmData))) { - NMLOG_TRACE("Call to %s for %s success", IARM_BUS_NM_SRV_MGR_NAME, IARM_BUS_NETSRVMGR_API_isInterfaceEnabled); + NMLOG_DEBUG("Call to %s for %s success", IARM_BUS_NM_SRV_MGR_NAME, IARM_BUS_NETSRVMGR_API_isInterfaceEnabled); isEnabled = iarmData.isInterfaceEnabled; rc = Core::ERROR_NONE; } @@ -821,7 +821,6 @@ namespace WPEFramework if (IARM_RESULT_SUCCESS == IARM_Bus_Call (IARM_BUS_NM_SRV_MGR_NAME, IARM_BUS_NETSRVMGR_API_getIPSettings, (void *)&iarmData, sizeof(iarmData))) { - NMLOG_TRACE("NetworkManagerImplementation::GetIPSettings - IARM Success.. Filling the data"); result.m_ipAddrType = string(iarmData.ipversion); result.m_autoConfig = iarmData.autoconfig; result.m_dhcpServer = string(iarmData.dhcpserver,MAX_IP_ADDRESS_LEN - 1); diff --git a/WiFiSignalStrengthMonitor.cpp b/WiFiSignalStrengthMonitor.cpp index 0230095..60165f9 100644 --- a/WiFiSignalStrengthMonitor.cpp +++ b/WiFiSignalStrengthMonitor.cpp @@ -66,7 +66,7 @@ namespace WPEFramework else NMLOG_ERROR("signalStrength is empty"); - NMLOG_TRACE("SSID = %s Signal Strength %f db", ssid.c_str(), signalStrengthOut); + NMLOG_DEBUG("SSID = %s Signal Strength %f db", ssid.c_str(), signalStrengthOut); if (signalStrengthOut == 0.0f) { quality = Exchange::INetworkManager::WIFI_SIGNAL_DISCONNECTED; @@ -114,7 +114,7 @@ namespace WPEFramework Exchange::INetworkManager::WiFiSignalQuality newSignalQuality; if (_instance != nullptr) { - NMLOG_TRACE("checking WiFi signal strength"); + NMLOG_DEBUG("checking WiFi signal strength"); getSignalData(ssid, newSignalQuality, signalStrength); if(oldSignalQuality != newSignalQuality) {