wrt-plugins-tizen_0.4.23
[framework/web/wrt-plugins-tizen.git] / src / Download / DownloadManager.cpp
index f489683..4cd771f 100644 (file)
@@ -112,7 +112,7 @@ static std::string _get_download_error(int err)
     }
 
     if (!success) {
-       LogError("Platform error %d <%s>", err, msg.c_str());
+       LoggerE("Platform error %d <%s>", err, msg.c_str());
     }
 
     return msg;
@@ -185,14 +185,14 @@ static gboolean downloadEventCB(void *data) {
 
                                ret = download_destroy(downloadId);
                                if (ret != DOWNLOAD_ERROR_NONE) {
-                                       LogWarning("Platform error while destroying download handle. downloadId=" << downloadId);
+                                       LoggerW("Platform error while destroying download handle. downloadId=" << downloadId);
                                }
 
                                std::string virtualPath;
                                try {
                                        virtualPath = DeviceAPI::Filesystem::Utils::toVirtualPath(NULL, fullPath);
                                } catch (...) {
-                                       LogWarning("Platform error while converting fullPath.");
+                                       LoggerW("Platform error while converting fullPath.");
                                        virtualPath = fullPath;
                                }
 
@@ -218,14 +218,14 @@ static gboolean downloadEventCB(void *data) {
                                std::string errMessage;
                                ret = download_get_error(downloadId, (download_error_e*)&err);
                                if (ret != DOWNLOAD_ERROR_NONE) {
-                                       LogWarning("Platform error while getting download error. ");
+                                       LoggerW("Platform error while getting download error. ");
                                } else {
                                        errMessage = _get_download_error(err);
                                }
 
                                ret = download_destroy(downloadId);
                                if (ret != DOWNLOAD_ERROR_NONE) {
-                                       LogWarning("Platform error while destroying download handle. downloadId=" << downloadId);
+                                       LoggerW("Platform error while destroying download handle. downloadId=" << downloadId);
                                }
 
                                UnknownException error(errMessage.c_str());
@@ -247,7 +247,7 @@ static gboolean downloadEventCB(void *data) {
 
                                ret = download_destroy(downloadId);
                                if (ret != DOWNLOAD_ERROR_NONE) {
-                                       LogWarning("Platform error while destroying download handle. downloadId=" << downloadId);
+                                       LoggerW("Platform error while destroying download handle. downloadId=" << downloadId);
                                }
 
                                callback->oncanceled(downloadId);
@@ -255,11 +255,11 @@ static gboolean downloadEventCB(void *data) {
                                break;
                        }
                        default:
-                               LogWarning("State changed is ignored.");
+                               LoggerW("State changed is ignored.");
                                break;
                }
        } catch (const BasePlatformException &err) {
-               LogError("download_state_changed_cb: %s", err.getMessage().c_str());
+               LoggerE("download_state_changed_cb: %s", err.getMessage().c_str());
        }
 
        delete fnData;
@@ -268,7 +268,7 @@ static gboolean downloadEventCB(void *data) {
 
 static void download_state_changed_cb(int downloadId, download_state_e state, void *user_data)
 {
-       LogDebug("download_state_changed_cb, downloadId=%d, state=%d", downloadId, (int)state);
+       LoggerD("download_state_changed_cb, downloadId=%d, state=%d", downloadId, (int)state);
        DOWNLOAD_EVENT_DATA_T *data = new DOWNLOAD_EVENT_DATA_T;
        data->downloadId = downloadId;
        data->state = state;
@@ -282,7 +282,7 @@ static void download_state_changed_cb(int downloadId, download_state_e state, vo
 
 static void download_progress_cb(int downloadId, unsigned long long received, void *user_data)
 {
-       LogDebug("download_progress_cb, downloadId=%d, received=%ld", downloadId, received);
+       LoggerD("download_progress_cb, downloadId=%d, received=%ld", downloadId, received);
        DOWNLOAD_EVENT_DATA_T *data = new DOWNLOAD_EVENT_DATA_T;
        data->downloadId = downloadId;
        data->state = DOWNLOAD_STATE_DOWNLOADING;
@@ -330,7 +330,7 @@ long DownloadManager::start(DownloadRequest *request, DownloadCallback *download
        int ret;
        int downloadId = 0;
 
-       LogDebug("entered");
+       LoggerD("entered");
 
        if (!request) {
                throw TypeMismatchException("request is NULL.");
@@ -342,7 +342,7 @@ long DownloadManager::start(DownloadRequest *request, DownloadCallback *download
        std::string networkType = request->getNetworkType();
        std::map<std::string, std::string> httpHeader = request->getHttpHeader();
 
-       LogDebug("url <%s>, destination <%s>, fileName <%s>", url.c_str(), destination.c_str(), fileName.c_str());
+       LoggerD("url <%s>, destination <%s>, fileName <%s>", url.c_str(), destination.c_str(), fileName.c_str());
 
        if (url.empty()) {
                throw InvalidValuesException("Invalid DownloadRequest.url.");
@@ -364,10 +364,10 @@ long DownloadManager::start(DownloadRequest *request, DownloadCallback *download
                        DeviceAPI::Filesystem::IPathPtr path = DeviceAPI::Filesystem::Utils::fromVirtualPath(NULL, destination);
                        fullPath = path->getFullPath();
                } catch (...) {
-                       LogWarning("Converting virtual path is failed. [%s]", destination.c_str());
+                       LoggerW("Converting virtual path is failed. [%s]", destination.c_str());
                        fullPath = destination;
                }
-               LogDebug("Converted FullPath = <%s>", fullPath.c_str());
+               LoggerD("Converted FullPath = <%s>", fullPath.c_str());
                ret = download_set_destination(downloadId, fullPath.c_str());
                if (ret != DOWNLOAD_ERROR_NONE) {
                        throw UnknownException(("Platform error while setting destination. " + _get_download_error(ret)).c_str());
@@ -420,7 +420,7 @@ long DownloadManager::start(DownloadRequest *request, DownloadCallback *download
                throw UnknownException(("Platform error while starting download. " + _get_download_error(ret)).c_str());
        }
 
-       LogDebug("downloadId: %d", downloadId);
+       LoggerD("downloadId: %d", downloadId);
 
        setCallbackToMap(downloadId, downloadCallback);
 
@@ -431,7 +431,7 @@ void DownloadManager::cancel(long downloadId)
 {
        int ret;
 
-       LogDebug("entered. downloadId = %d", downloadId);
+       LoggerD("entered. downloadId = %d", downloadId);
 
        ret = download_cancel(downloadId);
        if (ret != DOWNLOAD_ERROR_NONE) {
@@ -448,7 +448,7 @@ void DownloadManager::pause(long downloadId)
 {
        int ret;
 
-       LogDebug("entered. downloadId = %d", downloadId);
+       LoggerD("entered. downloadId = %d", downloadId);
 
        ret = download_pause(downloadId);
        if (ret != DOWNLOAD_ERROR_NONE) {
@@ -465,7 +465,7 @@ void DownloadManager::resume(long downloadId)
 {
        int ret;
 
-       LogDebug("entered. downloadId = %d", downloadId);
+       LoggerD("entered. downloadId = %d", downloadId);
 
        ret = download_start(downloadId);
        if (ret != DOWNLOAD_ERROR_NONE) {
@@ -484,7 +484,7 @@ std::string DownloadManager::getState(long downloadId)
        download_state_e state;
        std::string result;
 
-       LogDebug("entered. downloadId = %d", downloadId);
+       LoggerD("entered. downloadId = %d", downloadId);
 
        ret = download_get_state(downloadId, &state);
        if (ret != DOWNLOAD_ERROR_NONE) {
@@ -518,7 +518,7 @@ std::string DownloadManager::getState(long downloadId)
                        break;
                default:
                        result = "undefined";
-                       LogWarning("Unknown DownloadState was returned.");
+                       LoggerW("Unknown DownloadState was returned.");
                        break;
        }
 
@@ -538,7 +538,7 @@ DownloadRequest* DownloadManager::getDownloadRequest(long downloadId)
        char *fieldValue = NULL;
        int fieldLength = 0;
 
-       LogDebug("entered. downloadId = %d", downloadId);
+       LoggerD("entered. downloadId = %d", downloadId);
 
        ret = download_get_url(downloadId, &url);
        if (ret != DOWNLOAD_ERROR_NONE) {
@@ -594,7 +594,7 @@ DownloadRequest* DownloadManager::getDownloadRequest(long downloadId)
        for (i = 0; i < fieldLength; i++) {
                ret = download_get_http_header_field(downloadId, fieldNames[i], &fieldValue);
                if (ret != DOWNLOAD_ERROR_NONE) {
-                       LogWarning("Platform error while getting http header field. " << _get_download_error(ret));
+                       LoggerW("Platform error while getting http header field. " << _get_download_error(ret));
                }
                httpHeader.insert(make_pair(std::string(fieldNames[i]), std::string(fieldValue)));
                free(fieldNames[i]);
@@ -614,7 +614,7 @@ DownloadRequest* DownloadManager::getDownloadRequest(long downloadId)
                try {
                        virtualPath = DeviceAPI::Filesystem::Utils::toVirtualPath(NULL, destination);
                } catch (...) {
-                       LogWarning("Platform error while converting destination path.");
+                       LoggerW("Platform error while converting destination path.");
                        virtualPath = destination;
                }
                request->setDestination(virtualPath);
@@ -652,7 +652,7 @@ std::string DownloadManager::getMIMEType(long downloadId)
        char *mimeType = NULL;
        std::string result("");
 
-       LogDebug("entered. downloadId = %d", downloadId);
+       LoggerD("entered. downloadId = %d", downloadId);
 
        ret = download_get_mime_type(downloadId, &mimeType);
        if (ret != DOWNLOAD_ERROR_NONE) {
@@ -680,7 +680,7 @@ void DownloadManager::setListener(long downloadId, DownloadCallback *downloadCal
 {
        int ret;
 
-       LogDebug("entered. downloadId = %d", downloadId);
+       LoggerD("entered. downloadId = %d", downloadId);
 
        ret = download_set_state_changed_cb(downloadId, download_state_changed_cb, this);
        if (ret != DOWNLOAD_ERROR_NONE) {