JavaScript logging and error handling for AngularJS