[Pkg-privacy-commits] [xul-ext-monkeysphere] 258/296: Make log level more flexible.
Ximin Luo
infinity0 at moszumanska.debian.org
Mon Aug 24 07:39:46 UTC 2015
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch debian
in repository xul-ext-monkeysphere.
commit f3c35eb7d4777d6ca6c83a66e3af0c535c210c8d
Author: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
Date: Tue Dec 14 14:12:55 2010 -0500
Make log level more flexible.
---
Changelog | 2 +-
chrome/content/monkeysphere.js | 6 +++---
defaults/preferences/monkeysphere.js | 2 +-
modules/monkeysphere.jsm | 32 ++++++++++++++++++++++++++++----
4 files changed, 33 insertions(+), 9 deletions(-)
diff --git a/Changelog b/Changelog
index fbc0607..3ac8a8e 100644
--- a/Changelog
+++ b/Changelog
@@ -1,7 +1,7 @@
xul-ext-monkeysphere (0.5) upstream;
* code cleanup
- * add log_level preference, only honors 'silent' at the moment.
+ * add log_level preference.
* bump MaxVersion from 3.6.* to 4.0.* for firefox/iceweasel (thanks to
jaywalk for testing!)
* internationalize extension, add fr-FR localization (Thanks, julm!)
diff --git a/chrome/content/monkeysphere.js b/chrome/content/monkeysphere.js
index 0684dca..113b33c 100644
--- a/chrome/content/monkeysphere.js
+++ b/chrome/content/monkeysphere.js
@@ -351,14 +351,14 @@ var monkeysphere = (function() {
try {
var cert = browser.securityUI.SSLStatus.serverCert;
} catch(e) {
- ms.log("no valid cert found? probably already cleared?");
+ ms.mslog('error', "Confusion! No valid cert found for this site. Maybe already cleared?");
return;
}
var apd = ms.createAgentPostData(uri, cert);
apd.log();
ms.overrides.clear(apd);
if(ms.overrides.certStatus(apd)) {
- ms.log("**** WARNING: override cert not cleared ****");
+ ms.mslog('error', "**** WARNING: override cert not cleared ****");
alert(monkeysphere.messages.GetStringFromName('msErrorOverrideCertNotCleared'));
}
var newstate = "CLEARED";
@@ -377,7 +377,7 @@ var monkeysphere = (function() {
try {
var cert = browser.securityUI.SSLStatus.serverCert;
} catch(e) {
- ms.log("no valid cert found? probably already cleared?");
+ ms.mslog('error', "Confusion! No valid cert found for this site! Maybe already cleared?");
return;
}
var apd = ms.createAgentPostData(uri, cert);
diff --git a/defaults/preferences/monkeysphere.js b/defaults/preferences/monkeysphere.js
index c504c4f..5057ae1 100644
--- a/defaults/preferences/monkeysphere.js
+++ b/defaults/preferences/monkeysphere.js
@@ -1,3 +1,3 @@
pref("extensions.monkeysphere.validation_agent_socket_environment_variable", "MONKEYSPHERE_VALIDATION_AGENT_SOCKET");
pref("extensions.monkeysphere.default_socket", "http://localhost:8901");
-pref("extensions.monkeysphere.log_level", "silent");
+pref("extensions.monkeysphere.log_level", "error");
diff --git a/modules/monkeysphere.jsm b/modules/monkeysphere.jsm
index a9d74c9..cd03ff9 100644
--- a/modules/monkeysphere.jsm
+++ b/modules/monkeysphere.jsm
@@ -21,6 +21,7 @@
var EXPORTED_SYMBOLS = [
"agent_socket",
"log",
+ "elog",
"isRelevantURI",
"setStatus",
"createAgentPostData",
@@ -70,17 +71,40 @@ var agent_socket = function() {
// LOG FUNCTIONS
////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////
+var loglevels = {
+ silent: 0,
+ quiet: 0.25,
+ fatal: 0.5,
+ error: 1,
+ info: 2,
+ verbose: 3,
+ debug: 4,
+ debug1: 4,
+ debug2: 5,
+ debug3: 6
+};
+
var log = function(line) {
- var message = "monkeysphere: " + line;
+ return mslog('info', line);
+};
- var level = prefs.getCharPref("log_level").toLowerCase();
+//////////////////////////////////////////////////////////
+var mslog = function(level, line) {
+ var syslevel = prefs.getCharPref("log_level").toLowerCase();
+
+ level = loglevels[level];
+ syslevel = loglevels[syslevel];
+ if (typeof syslevel == 'undefined' ) {
+ syslevel = loglevels['info'];
+ }
- if(level == "silent") {
+ if(syslevel < level) {
return;
}
try {
+ var message = "monkeysphere: " + line;
+
dump(message + "\n");
try {
// this line works in extensions
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/xul-ext-monkeysphere.git
More information about the Pkg-privacy-commits
mailing list