diff --git a/js/controllers/settings.js b/js/controllers/settings.js
index 9671c5598..b629c459c 100644
--- a/js/controllers/settings.js
+++ b/js/controllers/settings.js
@@ -7,21 +7,42 @@ angular.module('copayApp.controllers').controller('SettingsController', function
$scope.defaultLanguage = config.defaultLanguage || 'en';
$scope.insightLivenet = config.network.livenet.url;
$scope.insightTestnet = config.network.testnet.url;
+ $scope.defaultLogLevel = config.logLevel || 'log';
+
+
+
+ //$scope.availableLogLevels = logger.levels;
+
+ $scope.availableLogLevels = {
+ 'debug': 0,
+ 'info': 1,
+ 'log': 2,
+ 'warn': 3,
+ 'error': 4,
+ 'fatal': 5
+ };
+
+ console.log($scope.defaultLogLevel);
+ console.log($scope.availableLogLevels);
+
+ for (var key in $scope.availableLogLevels) {
+ console.log("Ele " + key + " -- " + $scope.availableLogLevels[key])
+ }
$scope.availableStorages = [{
- name: 'Insight',
- pluginName: 'EncryptedInsightStorage',
- }, {
- name: 'Localstorage',
- pluginName: 'EncryptedLocalStorage',
- },
- // {
- // name: 'GoogleDrive',
- // pluginName: 'GoogleDrive',
- // }
+ name: 'Insight',
+ pluginName: 'EncryptedInsightStorage',
+ }, {
+ name: 'Localstorage',
+ pluginName: 'EncryptedLocalStorage',
+ },
+ // {
+ // name: 'GoogleDrive',
+ // pluginName: 'GoogleDrive',
+ // }
];
- _.each($scope.availableStorages, function(v){
+ _.each($scope.availableStorages, function(v) {
if (config.plugins[v.pluginName])
$scope.selectedStorage = v;
});
@@ -41,6 +62,13 @@ angular.module('copayApp.controllers').controller('SettingsController', function
}
}
+ for (var ii in $scope.availableLogLevels) {
+ if ($scope.defaultLogLevel === $scope.availableLogLevels[ii]) {
+ $scope.selectedLogLevel = $scope.availableLogLevels[ii];
+ break;
+ }
+ }
+
$scope.save = function() {
$scope.insightLivenet = copay.Insight.setCompleteUrl($scope.insightLivenet);
@@ -59,11 +87,14 @@ angular.module('copayApp.controllers').controller('SettingsController', function
var plugins = {};
plugins[$scope.selectedStorage.pluginName] = true;
+ logger.setLevel($scope.selectedLogLevel);
+
localStorage.setItem('config', JSON.stringify({
network: insightSettings,
version: copay.version,
defaultLanguage: $scope.selectedLanguage.isoCode,
plugins: plugins,
+ logLevel: $scope.selectedLogLevel,
}));
// Go home reloading the application
diff --git a/views/settings.html b/views/settings.html
index da62e5ca9..f0c097c16 100644
--- a/views/settings.html
+++ b/views/settings.html
@@ -35,7 +35,10 @@
Wallets and profiles are stored encrypted using your password as a key. You can store the encrypted data locally, on your platform, or remotely on the Insight Server. More pluggins are welcomed!
-
+
+
+