Reviewers: shindig-dev, Description: The os.log() function will now use Firebug console if available. Creates an alias to this as the global log() function for use by internal JSTemplate error handling.
Please review this at http://codereview.appspot.com/5681 Affected files: features/opensocial-templates/base.js Index: features/opensocial-templates/base.js =================================================================== --- features/opensocial-templates/base.js (revision 696676) +++ features/opensocial-templates/base.js (working copy) @@ -42,12 +42,26 @@ 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. +if (window['log']) { + // Overwrite existing variable if present. + log = os.log; +} else { + window['log'] = os.log; +} + /** * Logs a warning to the console. */

