Skip to content

Commit

Permalink
[API related] change LOG_NOTICE to LOG_INFO
Browse files Browse the repository at this point in the history
  • Loading branch information
AlwinEsch committed Apr 23, 2020
1 parent 06303ad commit f6cd28f
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 53 deletions.
34 changes: 17 additions & 17 deletions src/ApiManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@ static std::string get_mac_address()
{
std::string mac_addr;
#if defined(TARGET_ANDROID) && __ANDROID_API__ < 24
XBMC->Log(ADDON::LOG_NOTICE, "Can't get MAC address with target Android API < 24 (no getifaddrs() support)");
XBMC->Log(LOG_INFO, "Can't get MAC address with target Android API < 24 (no getifaddrs() support)");
#endif
#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD) || defined(TARGET_DARWIN)
struct ifaddrs * addrs;
if (0 != getifaddrs(&addrs))
{
XBMC->Log(ADDON::LOG_NOTICE, "While getting MAC address getifaddrs() failed, %s", strerror(errno));
XBMC->Log(LOG_INFO, "While getting MAC address getifaddrs() failed, %s", strerror(errno));
return mac_addr;
}
std::unique_ptr<struct ifaddrs, decltype (&freeifaddrs)> if_addrs{addrs, &freeifaddrs};
Expand Down Expand Up @@ -169,7 +169,7 @@ static std::string get_mac_address()
}
} else
{
XBMC->Log(ADDON::LOG_NOTICE, "GetAdaptersAddresses failed...");
XBMC->Log(LOG_INFO, "GetAdaptersAddresses failed...");
}
#endif
return mac_addr;
Expand All @@ -193,7 +193,7 @@ ApiManager::ApiManager(const std::string & userName
, m_pinUnlocked{false}
, m_sessionId{std::make_shared<std::string>()}
{
XBMC->Log(ADDON::LOG_NOTICE, "Loading ApiManager");
XBMC->Log(LOG_INFO, "Loading ApiManager");
}

std::string ApiManager::call(const std::string & urlPath, const ApiParams_t & paramsMap, bool putSessionVar) const
Expand Down Expand Up @@ -222,7 +222,7 @@ std::string ApiManager::call(const std::string & urlPath, const ApiParams_t & pa
}
else
{
XBMC->Log(ADDON::LOG_ERROR, "Cannot open url");
XBMC->Log(LOG_ERROR, "Cannot open url");
}

return response;
Expand All @@ -245,11 +245,11 @@ bool ApiManager::isSuccess(const std::string &response, Json::Value & root)
{
bool success = root.get("status", 0).asInt() == 1;
if (!success)
XBMC->Log(ADDON::LOG_ERROR, "Error indicated in response. status: %d, error: %s", root.get("status", 0).asInt(), root.get("error", "").asString().c_str());
XBMC->Log(LOG_ERROR, "Error indicated in response. status: %d, error: %s", root.get("status", 0).asInt(), root.get("error", "").asString().c_str());
return success;
}

XBMC->Log(ADDON::LOG_ERROR, "Error parsing response. Response is: %*s, reader error: %s", std::min(response.size(), static_cast<size_t>(1024)), response.c_str(), jsonReaderError.c_str());
XBMC->Log(LOG_ERROR, "Error parsing response. Response is: %*s, reader error: %s", std::min(response.size(), static_cast<size_t>(1024)), response.c_str(), jsonReaderError.c_str());
return false;
}

Expand Down Expand Up @@ -277,7 +277,7 @@ bool ApiManager::deletePairing(const Json::Value & root)
|| (del_root.get("error", "").asString() == "no device")
)
{
XBMC->Log(ADDON::LOG_NOTICE, "Previous pairing(deviceId:%s) deleted (or no such device)", old_dev_id.c_str());
XBMC->Log(LOG_INFO, "Previous pairing(deviceId:%s) deleted (or no such device)", old_dev_id.c_str());
return true;
}

Expand All @@ -292,7 +292,7 @@ bool ApiManager::pairDevice(Json::Value & root)
std::string macAddr = m_overridenMac.empty() ? get_mac_address() : m_overridenMac;
if (macAddr.empty())
{
XBMC->Log(ADDON::LOG_NOTICE, "Unable to get MAC address, using a dummy for serial");
XBMC->Log(LOG_INFO, "Unable to get MAC address, using a dummy for serial");
macAddr = "11223344";
}
// compute SHA256 of string representation of MAC address
Expand Down Expand Up @@ -340,7 +340,7 @@ bool ApiManager::pairDevice(Json::Value & root)
m_deviceId = buf;
m_password = passwd;

XBMC->Log(ADDON::LOG_DEBUG, "Device ID: %d, Password: %s", devId, passwd.c_str());
XBMC->Log(LOG_DEBUG, "Device ID: %d, Password: %s", devId, passwd.c_str());

const bool paired = !m_deviceId.empty() && !m_password.empty();

Expand All @@ -355,7 +355,7 @@ bool ApiManager::pairDevice(Json::Value & root)
}
else
{
XBMC->Log(ADDON::LOG_ERROR, "Error in pairing response.");
XBMC->Log(LOG_ERROR, "Error in pairing response.");
}

return false;
Expand All @@ -369,7 +369,7 @@ bool ApiManager::login()
{
if (!pairDevice(pairing_root))
{
XBMC->Log(ADDON::LOG_ERROR, "Cannot pair device");
XBMC->Log(LOG_ERROR, "Cannot pair device");
return false;
}
}
Expand All @@ -391,14 +391,14 @@ bool ApiManager::login()

if (new_session_id.empty())
{
XBMC->Log(ADDON::LOG_ERROR, "Cannot perform device login");
XBMC->Log(LOG_ERROR, "Cannot perform device login");
}
else
{
XBMC->Log(ADDON::LOG_NOTICE, "Device logged in. Session ID: %s", new_session_id.c_str());
XBMC->Log(LOG_INFO, "Device logged in. Session ID: %s", new_session_id.c_str());
}
} else if (response.empty()) {
XBMC->Log(ADDON::LOG_NOTICE, "No login response. Is something wrong with network or remote servers?");
XBMC->Log(LOG_INFO, "No login response. Is something wrong with network or remote servers?");
// don't do anything, let the state as is to give it another try
return false;
}
Expand Down Expand Up @@ -559,7 +559,7 @@ std::string ApiManager::urlEncode(const std::string &str)

std::string ApiManager::buildQueryString(const ApiParams_t & paramMap, bool putSessionVar) const
{
XBMC->Log(ADDON::LOG_DEBUG, "%s - size %d", __FUNCTION__, paramMap.size());
XBMC->Log(LOG_DEBUG, "%s - size %d", __FUNCTION__, paramMap.size());
std::string strOut;
for (const auto & param : paramMap)
{
Expand All @@ -586,7 +586,7 @@ std::string ApiManager::readPairFile()
std::string url = GetUserFilePath(PAIR_FILE);
std::string strContent;

XBMC->Log(ADDON::LOG_DEBUG, "Openning file %s", url.c_str());
XBMC->Log(LOG_DEBUG, "Openning file %s", url.c_str());

void* fileHandle = XBMC->OpenFile(url.c_str(), 0);
if (fileHandle)
Expand Down
Loading

0 comments on commit f6cd28f

Please sign in to comment.