add more log

This commit is contained in:
MaysWind 2016-12-11 01:01:28 +08:00
parent 74e3b8f614
commit f02c5556b7
6 changed files with 24 additions and 9 deletions

View file

@ -1,7 +1,7 @@
(function () {
'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 newUrlDownload = function (url) {
@ -21,6 +21,7 @@
var base64Url = $routeParams.url;
var url = base64.urldecode(base64Url);
$rootScope.loadPromise = newUrlDownload(url);
ariaNgLogService.info("[CommandController] new download: " + url);
} else {
ariaNgCommonService.error('Parameter is invalid!');
}

View file

@ -16,10 +16,10 @@
data: context.requestBody
};
ariaNgLogService.debug('Http Request Start', requestContext);
ariaNgLogService.debug('[aria2HttpRpcService.request] request start', requestContext);
return $http(requestContext).success(function (data) {
ariaNgLogService.debug('Http Response Success', data);
ariaNgLogService.debug('[aria2HttpRpcService.request] response success', data);
if (!data) {
return;
@ -29,7 +29,7 @@
context.successCallback(data.id, data.result);
}
}).error(function (data) {
ariaNgLogService.debug('Http Response Error', data);
ariaNgLogService.debug('[aria2HttpRpcService.request] response error', data);
if (!data) {
data = {

View file

@ -1,7 +1,7 @@
(function () {
'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) {
if (!stat) {
return stat;
@ -161,6 +161,7 @@
silent: !!silent,
callback: function (response) {
if (!callback) {
ariaNgLogService.warn("[aria2SettingService.getGlobalStat] callback is null");
return;
}

View file

@ -4,6 +4,7 @@
angular.module('ariaNg').factory('aria2TaskService', ['$q', '$translate', 'bittorrentPeeridService', 'aria2Errors', 'aria2RpcService', 'ariaNgCommonService', 'ariaNgLogService', function ($q, $translate, bittorrentPeeridService, aria2Errors, aria2RpcService, ariaNgCommonService, ariaNgLogService) {
var getFileName = function (file) {
if (!file) {
ariaNgLogService.warn("[aria2TaskService.getFileName] file is null");
return '';
}
@ -122,6 +123,7 @@
var processDownloadTask = function (task) {
if (!task) {
ariaNgLogService.warn("[aria2TaskService.processDownloadTask] task is null");
return task;
}
@ -174,6 +176,7 @@
var processBtPeers = function (peers, task, includeLocalPeer) {
if (!peers) {
ariaNgLogService.warn("[aria2TaskService.processBtPeers] peers is null");
return peers;
}
@ -272,6 +275,7 @@
silent: !!silent,
callback: function (response) {
if (!callback) {
ariaNgLogService.warn("[aria2TaskService.getTaskList] callback is null");
return;
}
@ -285,6 +289,7 @@
silent: !!silent,
callback: function (response) {
if (!callback) {
ariaNgLogService.warn("[aria2TaskService.getTaskStatus] callback is null");
return;
}
@ -333,6 +338,7 @@
silent: !!silent,
callback: function (response) {
if (!callback) {
ariaNgLogService.warn("[aria2TaskService.getBtTaskPeers] callback is null");
return;
}
@ -358,6 +364,7 @@
silent: !!silent,
callback: function (response) {
if (!callback) {
ariaNgLogService.warn("[aria2TaskService.getTaskStatusAndBtPeers] callback is null");
return;
}
@ -586,6 +593,7 @@
},
onFirstSuccess: function (callback) {
if (!callback) {
ariaNgLogService.warn("[aria2TaskService.onFirstSuccess] callback is null");
return;
}
@ -595,6 +603,7 @@
},
onTaskCompleted: function (callback) {
if (!callback) {
ariaNgLogService.warn("[aria2TaskService.onTaskCompleted] callback is null");
return;
}
@ -604,6 +613,7 @@
},
onBtTaskCompleted: function (callback) {
if (!callback) {
ariaNgLogService.warn("[aria2TaskService.onBtTaskCompleted] callback is null");
return;
}
@ -613,6 +623,7 @@
},
onTaskErrorOccur: function (callback) {
if (!callback) {
ariaNgLogService.warn("[aria2TaskService.onTaskErrorOccur] callback is null");
return;
}
@ -622,6 +633,7 @@
},
processDownloadTasks: function (tasks) {
if (!angular.isArray(tasks)) {
ariaNgLogService.warn("[aria2TaskService.processDownloadTasks] tasks is not array");
return;
}
@ -637,6 +649,7 @@
},
estimateHealthPercentFromPeers: function (task, peers) {
if (!task || task.numPieces < 1 || peers.length < 1) {
ariaNgLogService.warn("[aria2TaskService.estimateHealthPercentFromPeers] tasks is null or numPieces < 1 or peers < 1");
return task.completePercent;
}

View file

@ -29,13 +29,13 @@
});
if (content.result && context.successCallback) {
ariaNgLogService.debug('WebSocket Response Success', content);
ariaNgLogService.debug('[aria2WebSocketRpcService.request] response uccess', content);
context.successCallback(context.id, content.result);
}
if (content.error && context.errorCallback) {
ariaNgLogService.debug('WebSocket Response Error', content);
ariaNgLogService.debug('[aria2WebSocketRpcService.request] response error', content);
context.errorCallback(context.id, content.error);
}
@ -99,7 +99,7 @@
var uniqueId = context.uniqueId;
var requestBody = angular.toJson(context.requestBody);
ariaNgLogService.debug('WebSocket Request Start', context);
ariaNgLogService.debug('[aria2WebSocketRpcService.request] request start', context);
var deferred = $q.defer();

View file

@ -20,7 +20,7 @@
}, 100);
},
showError: function (text) {
ariaNgLogService.error("[Error Dialog] " + text);
ariaNgLogService.info("[ariaNgCommonService.showError] " + text);
this.showDialog('Error', text, 'error');
},
showOperationSucceeded: function (text) {