Logging application analytics and errors

We covered how to alert the user when things happen. Now, let's look at how you can build a logging service that you can use to alert you when things happen in your application.

Logging and tracing is another layer that cuts across all of the other layers in your application. The logging service we are going to cover uses a common JavaScript library called log4javascript. This library is very versatile and allows you to log either locally or remotely using the various appenders and layout formatters in the library. The following sample uses the basic BrowserConsoleAppender, which sends all output to the console window in your browser:

angular.module('brew-everywhere').factory('logging', function (messaging, ...

Get AngularJS Services now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.