开发者

Add logging in Javascript without polluting source code

I want to introduce logging (for analytics) in a web-application without polluting the source code by inserting log statements all over the place. The application is Javascript heavy. In a Java application, we would do something similar by using Aspect-oriented programming and leave the base source code clean. Is it possible to achieve something similar in Javascript?

One approach I am considering currently is to load the logging code sepa开发者_如何学Gorately and have it listen to specific events of interest. Since we are considering using backbone.js, we expect to have a event-driven mechanism which will publish various events. It should then be possible to listen to specific events and log them.

I would like to hear of other approaches/frameworks that developers have tried out.


Here is an Aspect-oriented programming plugin for jQuery: http://code.google.com/p/jquery-aop/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜