mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-04-18 08:08:28 +02:00
Improved logging on settings storage.
This commit is contained in:
parent
88b5e7668f
commit
6dc08534a6
@ -139,17 +139,25 @@
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
const storeValue = function storeValue(newValue){
|
const storeValue = function storeValue(newValue){
|
||||||
|
logging.verbose("Trying to store new value for %s", name, newValue);
|
||||||
settings[name] = newValue;
|
settings[name] = newValue;
|
||||||
if (!settingDefinition.transient){
|
if (!settingDefinition.transient){
|
||||||
var storeObject = {};
|
var storeObject = {};
|
||||||
storeObject[name] = newValue;
|
storeObject[name] = newValue;
|
||||||
browser.storage.local.set(storeObject);
|
browser.storage.local.set(storeObject).then(function(){
|
||||||
|
logging.verbose("New value stored for %s:", name, newValue);
|
||||||
|
}, function(err){
|
||||||
|
logging.warning("Unable to store new value for %s:", name, newValue, err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
logging.warning("Transient setting %s cannot be stored.", name);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (settingDefinition.urlSpecific){
|
if (settingDefinition.urlSpecific){
|
||||||
return function setValue(newValue, url){
|
return function setValue(newValue, url){
|
||||||
logging.verbose("New value for %s:", name, newValue);
|
logging.verbose("New value for %s (%s):", name, url, newValue);
|
||||||
if (isValid(newValue)){
|
if (isValid(newValue)){
|
||||||
if (url){
|
if (url){
|
||||||
var urlContainerValue = urlContainer.get();
|
var urlContainerValue = urlContainer.get();
|
||||||
@ -169,6 +177,9 @@
|
|||||||
storeValue(newValue);
|
storeValue(newValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
logging.warning("Invalid value for %s (%s):", name, url, newValue);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -177,6 +188,9 @@
|
|||||||
if (isValid(newValue)){
|
if (isValid(newValue)){
|
||||||
storeValue(newValue);
|
storeValue(newValue);
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
logging.warning("Invalid value for %s:", name, newValue);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user