[tbb-commits] [torbutton/master] Bug 26100: Don't use console object for logging

gk at torproject.org gk at torproject.org
Fri May 25 06:13:17 UTC 2018


commit 482abfb95de85bce98043338d8f7fcad9f6b7845
Author: Arthur Edelstein <arthuredelstein at gmail.com>
Date:   Thu May 17 23:05:44 2018 -0700

    Bug 26100: Don't use console object for logging
---
 src/modules/tor-control-port.js | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/src/modules/tor-control-port.js b/src/modules/tor-control-port.js
index 2b75e22..2c39936 100644
--- a/src/modules/tor-control-port.js
+++ b/src/modules/tor-control-port.js
@@ -26,14 +26,9 @@ Cu.import("resource://gre/modules/Services.jsm");
 
 // __log__.
 // Logging function
-let log;
-if ((typeof console) !== "undefined") {
-  log = x => console.log(typeof(x) === "string" ? x.trimRight().replace(/\r\n/g, "\n") : JSON.stringify(x));
-} else {
-  let logger = Cc["@torproject.org/torbutton-logger;1"]
-                 .getService(Components.interfaces.nsISupports).wrappedJSObject;
-  log = x => logger.eclog(3, x.trimRight().replace(/\r\n/g, "\n"));
-}
+let logger = Cc["@torproject.org/torbutton-logger;1"]
+               .getService(Components.interfaces.nsISupports).wrappedJSObject;
+let log = x => logger.eclog(3, x.trimRight().replace(/\r\n/g, "\n"));
 
 // ### announce this file
 log("Loading tor-control-port.js\n");



More information about the tbb-commits mailing list