Skip to content

Instantly share code, notes, and snippets.

@jleyba
Created October 11, 2013 17:53
Show Gist options
  • Select an option

  • Save jleyba/6939136 to your computer and use it in GitHub Desktop.

Select an option

Save jleyba/6939136 to your computer and use it in GitHub Desktop.
Add logging using Closure. Logged messages will be printed to the DOM.
goog.require('goog.debug.DivConsole');
goog.require('goog.debug.LogManager');
goog.require('goog.log');
var div = document.createElement('div');
document.body.appendChild(div);
var divConsole = new goog.debug.DivConsole(div);
divConsole.setCapturing(true);
var log = goog.log.getLogger('my.logger');
goog.log.info(log, 'Hello, world!');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment