mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2024-12-22 12:50:36 +01:00
Improved logging on settings storage.
This commit is contained in:
parent
88b5e7668f
commit
6dc08534a6
@ -139,17 +139,25 @@
|
||||
return true;
|
||||
};
|
||||
const storeValue = function storeValue(newValue){
|
||||
logging.verbose("Trying to store new value for %s", name, newValue);
|
||||
settings[name] = newValue;
|
||||
if (!settingDefinition.transient){
|
||||
var storeObject = {};
|
||||
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){
|
||||
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 (url){
|
||||
var urlContainerValue = urlContainer.get();
|
||||
@ -169,6 +177,9 @@
|
||||
storeValue(newValue);
|
||||
}
|
||||
}
|
||||
else{
|
||||
logging.warning("Invalid value for %s (%s):", name, url, newValue);
|
||||
}
|
||||
};
|
||||
}
|
||||
else {
|
||||
@ -177,6 +188,9 @@
|
||||
if (isValid(newValue)){
|
||||
storeValue(newValue);
|
||||
}
|
||||
else{
|
||||
logging.warning("Invalid value for %s:", name, newValue);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user