add more log
This commit is contained in:
parent
74e3b8f614
commit
f02c5556b7
|
@ -1,7 +1,7 @@
|
||||||
(function () {
|
(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('ariaNg').controller('CommandController', ['$rootScope', '$location', '$routeParams', 'base64', 'ariaNgCommonService', 'aria2TaskService', function ($rootScope, $location, $routeParams, base64, ariaNgCommonService, aria2TaskService) {
|
angular.module('ariaNg').controller('CommandController', ['$rootScope', '$location', '$routeParams', 'base64', 'ariaNgCommonService', 'aria2TaskService', 'ariaNgLogService', function ($rootScope, $location, $routeParams, base64, ariaNgCommonService, aria2TaskService, ariaNgLogService) {
|
||||||
var path = $location.path();
|
var path = $location.path();
|
||||||
|
|
||||||
var newUrlDownload = function (url) {
|
var newUrlDownload = function (url) {
|
||||||
|
@ -21,6 +21,7 @@
|
||||||
var base64Url = $routeParams.url;
|
var base64Url = $routeParams.url;
|
||||||
var url = base64.urldecode(base64Url);
|
var url = base64.urldecode(base64Url);
|
||||||
$rootScope.loadPromise = newUrlDownload(url);
|
$rootScope.loadPromise = newUrlDownload(url);
|
||||||
|
ariaNgLogService.info("[CommandController] new download: " + url);
|
||||||
} else {
|
} else {
|
||||||
ariaNgCommonService.error('Parameter is invalid!');
|
ariaNgCommonService.error('Parameter is invalid!');
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,10 +16,10 @@
|
||||||
data: context.requestBody
|
data: context.requestBody
|
||||||
};
|
};
|
||||||
|
|
||||||
ariaNgLogService.debug('Http Request Start', requestContext);
|
ariaNgLogService.debug('[aria2HttpRpcService.request] request start', requestContext);
|
||||||
|
|
||||||
return $http(requestContext).success(function (data) {
|
return $http(requestContext).success(function (data) {
|
||||||
ariaNgLogService.debug('Http Response Success', data);
|
ariaNgLogService.debug('[aria2HttpRpcService.request] response success', data);
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return;
|
return;
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
context.successCallback(data.id, data.result);
|
context.successCallback(data.id, data.result);
|
||||||
}
|
}
|
||||||
}).error(function (data) {
|
}).error(function (data) {
|
||||||
ariaNgLogService.debug('Http Response Error', data);
|
ariaNgLogService.debug('[aria2HttpRpcService.request] response error', data);
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
data = {
|
data = {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
(function () {
|
(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('ariaNg').factory('aria2SettingService', ['aria2AllOptions', 'aria2GlobalAvailableOptions', 'aria2TaskAvailableOptions', 'ariaNgCommonService', 'aria2RpcService', function (aria2AllOptions, aria2GlobalAvailableOptions, aria2TaskAvailableOptions, ariaNgCommonService, aria2RpcService) {
|
angular.module('ariaNg').factory('aria2SettingService', ['aria2AllOptions', 'aria2GlobalAvailableOptions', 'aria2TaskAvailableOptions', 'ariaNgCommonService', 'aria2RpcService', 'ariaNgLogService', function (aria2AllOptions, aria2GlobalAvailableOptions, aria2TaskAvailableOptions, ariaNgCommonService, aria2RpcService, ariaNgLogService) {
|
||||||
var processStatResult = function (stat) {
|
var processStatResult = function (stat) {
|
||||||
if (!stat) {
|
if (!stat) {
|
||||||
return stat;
|
return stat;
|
||||||
|
@ -161,6 +161,7 @@
|
||||||
silent: !!silent,
|
silent: !!silent,
|
||||||
callback: function (response) {
|
callback: function (response) {
|
||||||
if (!callback) {
|
if (!callback) {
|
||||||
|
ariaNgLogService.warn("[aria2SettingService.getGlobalStat] callback is null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
angular.module('ariaNg').factory('aria2TaskService', ['$q', '$translate', 'bittorrentPeeridService', 'aria2Errors', 'aria2RpcService', 'ariaNgCommonService', 'ariaNgLogService', function ($q, $translate, bittorrentPeeridService, aria2Errors, aria2RpcService, ariaNgCommonService, ariaNgLogService) {
|
angular.module('ariaNg').factory('aria2TaskService', ['$q', '$translate', 'bittorrentPeeridService', 'aria2Errors', 'aria2RpcService', 'ariaNgCommonService', 'ariaNgLogService', function ($q, $translate, bittorrentPeeridService, aria2Errors, aria2RpcService, ariaNgCommonService, ariaNgLogService) {
|
||||||
var getFileName = function (file) {
|
var getFileName = function (file) {
|
||||||
if (!file) {
|
if (!file) {
|
||||||
|
ariaNgLogService.warn("[aria2TaskService.getFileName] file is null");
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,6 +123,7 @@
|
||||||
|
|
||||||
var processDownloadTask = function (task) {
|
var processDownloadTask = function (task) {
|
||||||
if (!task) {
|
if (!task) {
|
||||||
|
ariaNgLogService.warn("[aria2TaskService.processDownloadTask] task is null");
|
||||||
return task;
|
return task;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,6 +176,7 @@
|
||||||
|
|
||||||
var processBtPeers = function (peers, task, includeLocalPeer) {
|
var processBtPeers = function (peers, task, includeLocalPeer) {
|
||||||
if (!peers) {
|
if (!peers) {
|
||||||
|
ariaNgLogService.warn("[aria2TaskService.processBtPeers] peers is null");
|
||||||
return peers;
|
return peers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,6 +275,7 @@
|
||||||
silent: !!silent,
|
silent: !!silent,
|
||||||
callback: function (response) {
|
callback: function (response) {
|
||||||
if (!callback) {
|
if (!callback) {
|
||||||
|
ariaNgLogService.warn("[aria2TaskService.getTaskList] callback is null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,6 +289,7 @@
|
||||||
silent: !!silent,
|
silent: !!silent,
|
||||||
callback: function (response) {
|
callback: function (response) {
|
||||||
if (!callback) {
|
if (!callback) {
|
||||||
|
ariaNgLogService.warn("[aria2TaskService.getTaskStatus] callback is null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,6 +338,7 @@
|
||||||
silent: !!silent,
|
silent: !!silent,
|
||||||
callback: function (response) {
|
callback: function (response) {
|
||||||
if (!callback) {
|
if (!callback) {
|
||||||
|
ariaNgLogService.warn("[aria2TaskService.getBtTaskPeers] callback is null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,6 +364,7 @@
|
||||||
silent: !!silent,
|
silent: !!silent,
|
||||||
callback: function (response) {
|
callback: function (response) {
|
||||||
if (!callback) {
|
if (!callback) {
|
||||||
|
ariaNgLogService.warn("[aria2TaskService.getTaskStatusAndBtPeers] callback is null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -586,6 +593,7 @@
|
||||||
},
|
},
|
||||||
onFirstSuccess: function (callback) {
|
onFirstSuccess: function (callback) {
|
||||||
if (!callback) {
|
if (!callback) {
|
||||||
|
ariaNgLogService.warn("[aria2TaskService.onFirstSuccess] callback is null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -595,6 +603,7 @@
|
||||||
},
|
},
|
||||||
onTaskCompleted: function (callback) {
|
onTaskCompleted: function (callback) {
|
||||||
if (!callback) {
|
if (!callback) {
|
||||||
|
ariaNgLogService.warn("[aria2TaskService.onTaskCompleted] callback is null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -604,6 +613,7 @@
|
||||||
},
|
},
|
||||||
onBtTaskCompleted: function (callback) {
|
onBtTaskCompleted: function (callback) {
|
||||||
if (!callback) {
|
if (!callback) {
|
||||||
|
ariaNgLogService.warn("[aria2TaskService.onBtTaskCompleted] callback is null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -613,6 +623,7 @@
|
||||||
},
|
},
|
||||||
onTaskErrorOccur: function (callback) {
|
onTaskErrorOccur: function (callback) {
|
||||||
if (!callback) {
|
if (!callback) {
|
||||||
|
ariaNgLogService.warn("[aria2TaskService.onTaskErrorOccur] callback is null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -622,6 +633,7 @@
|
||||||
},
|
},
|
||||||
processDownloadTasks: function (tasks) {
|
processDownloadTasks: function (tasks) {
|
||||||
if (!angular.isArray(tasks)) {
|
if (!angular.isArray(tasks)) {
|
||||||
|
ariaNgLogService.warn("[aria2TaskService.processDownloadTasks] tasks is not array");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -637,6 +649,7 @@
|
||||||
},
|
},
|
||||||
estimateHealthPercentFromPeers: function (task, peers) {
|
estimateHealthPercentFromPeers: function (task, peers) {
|
||||||
if (!task || task.numPieces < 1 || peers.length < 1) {
|
if (!task || task.numPieces < 1 || peers.length < 1) {
|
||||||
|
ariaNgLogService.warn("[aria2TaskService.estimateHealthPercentFromPeers] tasks is null or numPieces < 1 or peers < 1");
|
||||||
return task.completePercent;
|
return task.completePercent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,13 +29,13 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
if (content.result && context.successCallback) {
|
if (content.result && context.successCallback) {
|
||||||
ariaNgLogService.debug('WebSocket Response Success', content);
|
ariaNgLogService.debug('[aria2WebSocketRpcService.request] response uccess', content);
|
||||||
|
|
||||||
context.successCallback(context.id, content.result);
|
context.successCallback(context.id, content.result);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (content.error && context.errorCallback) {
|
if (content.error && context.errorCallback) {
|
||||||
ariaNgLogService.debug('WebSocket Response Error', content);
|
ariaNgLogService.debug('[aria2WebSocketRpcService.request] response error', content);
|
||||||
|
|
||||||
context.errorCallback(context.id, content.error);
|
context.errorCallback(context.id, content.error);
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@
|
||||||
var uniqueId = context.uniqueId;
|
var uniqueId = context.uniqueId;
|
||||||
var requestBody = angular.toJson(context.requestBody);
|
var requestBody = angular.toJson(context.requestBody);
|
||||||
|
|
||||||
ariaNgLogService.debug('WebSocket Request Start', context);
|
ariaNgLogService.debug('[aria2WebSocketRpcService.request] request start', context);
|
||||||
|
|
||||||
var deferred = $q.defer();
|
var deferred = $q.defer();
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
}, 100);
|
}, 100);
|
||||||
},
|
},
|
||||||
showError: function (text) {
|
showError: function (text) {
|
||||||
ariaNgLogService.error("[Error Dialog] " + text);
|
ariaNgLogService.info("[ariaNgCommonService.showError] " + text);
|
||||||
this.showDialog('Error', text, 'error');
|
this.showDialog('Error', text, 'error');
|
||||||
},
|
},
|
||||||
showOperationSucceeded: function (text) {
|
showOperationSucceeded: function (text) {
|
||||||
|
|
Reference in a new issue