The AngularJS $logProvider
Enabling the $logProvider is as simple as injecting the $log object into your object and then calling $log.debug(); to send logs to the console.
Turning off logging
You can disable logging (AngularJS 1.1.2+) by calling
AngularJS provides a mechanisms to extend the built in $logProvider, $provider.decorator(). An example will get the point across much more quickly than me trying to explain it all.
Basically we intercept the call using decorate so we can add on the features and functionality we need to the $log.debug() call.
AngualrJS version 1.2.16 was used as a basis for this article.
Thanks to Burleson Thomas and this post for the extension example.
This got me thinking.
Maybe it’ll get you thinking too.