Fronter Angular.js module to easily enable logging to a back end service from the front end.
To start using this Angular.js module you first need to add this project as a bower dependency in your bower.json file:
...
"dependencies": {
"fng-remote-logging": "https://gitlab.fronter.net/frontend-modules/fng-remote-logging.git#0.0.5"
}
...
You also need to add this to your index.html:
<script src="/bower_components/fng-remote-logging/build/fng-remote-logging.min.js"></script>
And do the actual logging you need to use the rlog service instead of the Angular.js $log service:
var module = angular.module('myApp', ['fng.remote.logging']);
module.constant('REMOTE_LOGGING_URL', '/logging'); //This is a requirement for the remote logging module
module.controller('main', function ($scope, rlog) {
rlog.info('logging some stuff to the console and to the backend');
});
When you have imported the remote logging module as stated above you only need to add the exceptionHandler override to your index.html to automatically start logging exceptions:
<script src="/bower_components/fng-remote-logging/build/fng-exception-handler-override.min.js"></script>
Before anything you need to run npm install
as with any node.js application!
- To run tests:
npm test
- location of coverage report when/after running tests:
./coverage/PhantomJS 1.9.7 (Mac OS X)/index.html
- location of coverage report when/after running tests:
- To start the server for the example:
npm start
- To start it on a different port use:
PORT=<port> npm start
- To start it on a different port use:
- To lint the code:
npm run lint
- To get constant feedback when developing:
npm run watch
- To generate new minified versions of the module:
npm run build
When releasing this module it is important to update all of the versions:
- Update the version in package.json
- Update the version in bower.json
- Tag the current commit in Git
- The multiple places in this README that mentions the versions
<major>.<minor>.<patch>
Meaning:
- major: You break the api
- minor: You add to the api
- patch: Everything else
- Make this project browserify compatible. (Karl Gustav)
- Create a standalone branch, with injected ajax. (Gavin)
- Extract the http posting out into a transport service, so that people can choose to send logs over sockets for instance (Petter)
* http://en.wikipedia.org/wiki/Software_release_life_cycle#Alpha