You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by ev...@apache.org on 2008/09/22 19:31:07 UTC

svn commit: r697913 - /incubator/shindig/trunk/features/opensocial-templates/base.js

Author: evan
Date: Mon Sep 22 10:31:06 2008
New Revision: 697913

URL: http://svn.apache.org/viewvc?rev=697913&view=rev
Log:
Patch for SHINDIG-615 to enable template logging

note: Changed to if (typeof log != 'undefined') and added TODO to remove global namespace logging when available with JsTemplates

Modified:
    incubator/shindig/trunk/features/opensocial-templates/base.js

Modified: incubator/shindig/trunk/features/opensocial-templates/base.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-templates/base.js?rev=697913&r1=697912&r2=697913&view=diff
==============================================================================
--- incubator/shindig/trunk/features/opensocial-templates/base.js (original)
+++ incubator/shindig/trunk/features/opensocial-templates/base.js Mon Sep 22 10:31:06 2008
@@ -42,12 +42,27 @@
 var os = opensocial.template;
 
 /**
- * Sends a log to the console.
+ * Sends a log to the console. Currently uses Firebug console if available,
+ * otherwise supresses the message.
+ * TODO: What other logging APIs can we use? Does gadgets provide one?
+ * @param {string} msg The message to send.
  */
 os.log = function(msg) {
-  log("LOG: " + msg);
+  var console = window['console'];
+  if (console && console.log) {
+    console.log(msg);
+  }
 };
 
+// Register our logging function as the global logger function.
+// TODO: Remove global variables once JsTemplates supports setting logger
+if (typeof log != 'undefined') {
+  // Overwrite existing variable if present.
+  log = os.log;
+} else {
+  window['log'] = os.log;
+}
+
 /**
  * Logs a warning to the console.
  */