title: A JavaScript frontend logging system that logs to our backend?
body: <p>We have an established logging system for our server-side services. Specifically, our Django project makes heavy use of the Python logging module, so call calls to <code>logger.info()</code>, <code>logger.warn()</code> and <code>logger.error()</code> get picked up by our centralized logging system.</p>
  
  <p>I would like an equivalent on our frontend, and I've got a few ideas:</p>
  
  <ol>
  <li><p>There would be some sort of custom logging object exposed via JavaScript that would send messages to backend via an XmlHttpRequest.</p></li>
  <li><p>I'd like to have equivalent logging levels on the client-side: <code>debug</code>, <code>info</code>, <code>warning</code> and <code>error</code>.</p></li>
  <li><p>When we're developing locally (debug mode), I'd like those logging messages to be logged to the browser/Firebug console via <code>console.log()</code>.</p></li>
  <li><p>In production, <code>debug</code> messages should be dropped completely.</p></li>
  <li><p>I recall seeing a way to capture all uncaught JavaScript exceptions, so these should be logged at the <code>error</code> level.</p></li>
  <li><p>We're already using <a href="http://code.google.com/apis/analytics/docs/tracking/eventTrackerGuide.html" rel="noreferrer">Google Analytics event tracking</a>, and it'd be nice for whatever system we create to tie into that somehow.</p></li>
  </ol>
  
  <p>Is this a good idea? How would you do this? Are there existing solutions?</p>
  
  <p>(FWIW, we're using jQuery on the frontend.)</p>
  
  <p><strong>Update:</strong> Simplified question here: <a href="https://stackoverflow.com/questions/1423267/are-there-any-logging-frameworks-for-javascript">https://stackoverflow.com/questions/1423267/are-there-any-logging-frameworks-for-javascript</a></p>