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 logger.info()
, logger.warn()
and logger.error()
get picked up by our centralized logging system.
I would like an equivalent on our frontend, and I've got a few ideas:
There would be some sort of custom logging object exposed via JavaScript that would send messages to backend via an XmlHttpRequest.
I'd like to have equivalent logging levels on the client-side:
debug
,info
,warning
anderror
.When we're developing locally (debug mode), I'd like those logging messages to be logged to the browser/Firebug console via
console.log()
.In production,
debug
messages should be dropped completely.I recall seeing a way to capture all uncaught JavaScript exceptions, so these should be logged at the
error
level.We're already using Google Analytics event tracking, and it'd be nice for whatever system we create to tie into that somehow.
Is this a good idea? How would you do this? Are there existing solutions?
(FWIW, we're using jQuery on the frontend.)
Update: Simplified question here: https://stackoverflow.com/questions/1423267/are-there-any-logging-frameworks-for-javascript