aboutsummaryrefslogtreecommitdiff
path: root/backends/cloud/box
diff options
context:
space:
mode:
authorAlexander Tkachev2016-07-23 12:52:27 +0600
committerAlexander Tkachev2016-08-24 16:07:55 +0600
commit15c6772ff7638e104027f7b7777180e6191841fc (patch)
tree7887ce51ef6c3d6fd7ab574aa0e7da85d47067f8 /backends/cloud/box
parentd57e0c89b5b20dac247cb2f43450014d84719ba6 (diff)
downloadscummvm-rg350-15c6772ff7638e104027f7b7777180e6191841fc.tar.gz
scummvm-rg350-15c6772ff7638e104027f7b7777180e6191841fc.tar.bz2
scummvm-rg350-15c6772ff7638e104027f7b7777180e6191841fc.zip
ALL: Fix debug, warning and error usage
Added prefixes, used debug(9).
Diffstat (limited to 'backends/cloud/box')
-rw-r--r--backends/cloud/box/boxstorage.cpp16
-rw-r--r--backends/cloud/box/boxtokenrefresher.cpp6
-rw-r--r--backends/cloud/box/boxuploadrequest.cpp7
3 files changed, 15 insertions, 14 deletions
diff --git a/backends/cloud/box/boxstorage.cpp b/backends/cloud/box/boxstorage.cpp
index 401ec6a115..c2c4c6278e 100644
--- a/backends/cloud/box/boxstorage.cpp
+++ b/backends/cloud/box/boxstorage.cpp
@@ -115,8 +115,8 @@ void BoxStorage::tokenRefreshed(BoolCallback callback, Networking::JsonResponse
Common::JSONObject result = json->asObject();
if (!result.contains("access_token") || !result.contains("refresh_token")) {
- warning("Bad response, no token passed");
- debug("%s", json->stringify().c_str());
+ warning("BoxStorage: bad response, no token passed");
+ debug(9, "%s", json->stringify().c_str());
if (callback)
(*callback)(BoolResponse(nullptr, false));
} else {
@@ -141,8 +141,8 @@ void BoxStorage::codeFlowComplete(BoolResponse response) {
}
void BoxStorage::codeFlowFailed(Networking::ErrorResponse error) {
- debug("Box's code flow failed (%s, %ld):", (error.failed ? "failed" : "interrupted"), error.httpResponseCode);
- debug("%s", error.response.c_str());
+ debug(9, "BoxStorage: code flow failed (%s, %ld):", (error.failed ? "failed" : "interrupted"), error.httpResponseCode);
+ debug(9, "%s", error.response.c_str());
CloudMan.removeStorage(this);
}
@@ -158,7 +158,7 @@ Common::String BoxStorage::name() const {
void BoxStorage::infoInnerCallback(StorageInfoCallback outerCallback, Networking::JsonResponse response) {
Common::JSONValue *json = response.value;
if (!json) {
- warning("NULL passed instead of JSON");
+ warning("BoxStorage::infoInnerCallback: NULL passed instead of JSON");
delete outerCallback;
return;
}
@@ -210,7 +210,7 @@ Networking::Request *BoxStorage::listDirectoryById(Common::String id, ListDirect
void BoxStorage::createDirectoryInnerCallback(BoolCallback outerCallback, Networking::JsonResponse response) {
Common::JSONValue *json = response.value;
if (!json) {
- warning("NULL passed instead of JSON");
+ warning("BoxStorage::createDirectoryInnerCallback: NULL passed instead of JSON");
delete outerCallback;
return;
}
@@ -292,12 +292,12 @@ BoxStorage *BoxStorage::loadFromConfig(Common::String keyPrefix) {
loadKeyAndSecret();
if (!ConfMan.hasKey(keyPrefix + "access_token", ConfMan.kCloudDomain)) {
- warning("No access_token found");
+ warning("BoxStorage: no access_token found");
return nullptr;
}
if (!ConfMan.hasKey(keyPrefix + "refresh_token", ConfMan.kCloudDomain)) {
- warning("No refresh_token found");
+ warning("BoxStorage: no refresh_token found");
return nullptr;
}
diff --git a/backends/cloud/box/boxtokenrefresher.cpp b/backends/cloud/box/boxtokenrefresher.cpp
index 65964f3010..c798b97343 100644
--- a/backends/cloud/box/boxtokenrefresher.cpp
+++ b/backends/cloud/box/boxtokenrefresher.cpp
@@ -69,7 +69,7 @@ void BoxTokenRefresher::finishJson(Common::JSONValue *json) {
long httpCode = -1;
if (_stream) {
httpCode = _stream->httpResponseCode();
- debug(9, "code %ld", httpCode);
+ debug(9, "BoxTokenRefresher: code %ld", httpCode);
}
bool irrecoverable = true;
@@ -77,12 +77,12 @@ void BoxTokenRefresher::finishJson(Common::JSONValue *json) {
Common::String code, message;
if (result.contains("code")) {
code = result.getVal("code")->asString();
- debug(9, "code = %s", code.c_str());
+ debug(9, "BoxTokenRefresher: code = %s", code.c_str());
}
if (result.contains("message")) {
message = result.getVal("message")->asString();
- debug(9, "message = %s", message.c_str());
+ debug(9, "BoxTokenRefresher: message = %s", message.c_str());
}
//TODO: decide when token refreshment will help
diff --git a/backends/cloud/box/boxuploadrequest.cpp b/backends/cloud/box/boxuploadrequest.cpp
index 29034c479f..f68ba6a580 100644
--- a/backends/cloud/box/boxuploadrequest.cpp
+++ b/backends/cloud/box/boxuploadrequest.cpp
@@ -143,8 +143,9 @@ void BoxUploadRequest::uploadedCallback(Networking::JsonResponse response) {
}
if (error.httpResponseCode != 200 && error.httpResponseCode != 201)
- warning("looks like an error");
+ warning("BoxUploadRequest: looks like an error (bad HTTP code)");
+ //TODO: add more JSON warnings there
Common::JSONValue *json = response.value;
if (json) {
if (json->isObject()) {
@@ -188,10 +189,10 @@ void BoxUploadRequest::uploadedCallback(Networking::JsonResponse response) {
*/
}
- warning("no file info to return");
+ warning("BoxUploadRequest: no file info to return");
finishUpload(StorageFile(_savePath, 0, 0, false));
} else {
- warning("null, not json");
+ warning("BoxUploadRequest: null, not json");
finishError(error);
}