update log4moz to weave's current copy, per dmose.
authorAndrew Sutherland <asutherland@asutherland.org>
Tue, 07 Oct 2008 18:14:59 -0700
changeset 967 aa83bf9d9c7198db135d6fe8a9dca92d426b5b32
parent 966 0250d7e58b7b4e885e3e264d06b64a13091f4228
child 968 772a38efff65e2f1eaf42fe30256db226c134deb
push idunknown
push userunknown
push dateunknown
update log4moz to weave's current copy, per dmose.
modules/log4moz.js
--- a/modules/log4moz.js
+++ b/modules/log4moz.js
@@ -87,17 +87,55 @@ let Log4Moz = {
   },
 
   get Formatter() { return Formatter; },
   get BasicFormatter() { return BasicFormatter; },
   get Appender() { return Appender; },
   get DumpAppender() { return DumpAppender; },
   get ConsoleAppender() { return ConsoleAppender; },
   get FileAppender() { return FileAppender; },
-  get RotatingFileAppender() { return RotatingFileAppender; }
+  get RotatingFileAppender() { return RotatingFileAppender; },
+
+  // Logging helper:
+  // let logger = Log4Moz.Service.getLogger("foo");
+  // logger.info(Log4Moz.enumerateInterfaces(someObject).join(","));
+  enumerateInterfaces: function(aObject) {
+    let interfaces = [];
+
+    for (i in Ci) {
+      try {
+        aObject.QueryInterface(Ci[i]);
+        interfaces.push(i);
+      }
+      catch(ex) {}
+    }
+
+    return interfaces;
+  },
+
+  // Logging helper:
+  // let logger = Log4Moz.Service.getLogger("foo");
+  // logger.info(Log4Moz.enumerateProperties(someObject).join(","));
+  enumerateProperties: function(aObject, aExcludeComplexTypes) {
+    let properties = [];
+
+    for (p in aObject) {
+      try {
+        if (aExcludeComplexTypes &&
+            (typeof aObject[p] == "object" || typeof aObject[p] == "function"))
+          continue;
+        properties.push(p + " = " + aObject[p]);
+      }
+      catch(ex) {
+        properties.push(p + " = " + ex);
+      }
+    }
+
+    return properties;
+  }
 };
 
 
 /*
  * LogMessage
  * Encapsulates a single log event's data
  */
 function LogMessage(loggerName, level, message){
@@ -111,17 +149,17 @@ LogMessage.prototype = {
 
   get levelDesc() {
     if (this.level in Log4Moz.Level.Desc)
       return Log4Moz.Level.Desc[this.level];
     return "UNKNOWN";
   },
 
   toString: function LogMsg_toString(){
-    return "LogMessage [" + this._date + " " + this.level + " " +
+    return "LogMessage [" + this.time + " " + this.level + " " +
       this.message + "]";
   }
 };
 
 /*
  * Logger
  * Hierarchical version.  Logs to all appenders, assigned or inherited
  */