Angularjs Console.log

HTML

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<div ng-controller="myCtrl">
  <button ng-click="check(obj,array)">
    check
  </button>
  <p>
  {{valid}}
  </p>
</div>

JavaScript

// Throw error outside angularjs
//console.log('=== outside angularjs ===');
//console.log(jsError);

// External Directive
angular.module('external', [])
  .directive('externalDirective', function($parse) {
    return {
      restrict: 'E',
      controller: function($scope) {
        $scope.name = 'External Directive Here!';

        // Throws error in external directive
        //console.log('=== inside angularjs external directive ===');
        //console.log(externalDirectiveError);

      },
      template: '<p>{{name}}</p>'
    };
  })
  .factory('externalService', function() {
    return ({
      name: name()
    });

    function name() {

      // Throws error in external service
      console.log('=== inside angularjs external service ===');
      console.log(externalServiceError);

      return 'External Service Here!'
    }
  })

// Declare the app and use the external module
angular.module('app', ['external'])

// Controller with error
.controller('myCtrl', function($scope, externalService) {
  $scope.obj = {name:'Joffin',age:'24'};
  $scope.array = [{name:'wilma',age:'34'},{name:'Joffin',age:'24'}]
  $scope.check = function(obj,array){
  	for(var i=0;i<array.length;i++){
    	if(array[i]==obj){
      	$scope.valid = true;
        return
      }
      $scope.valid = false;
    }
  }

  // Throw error inside angularjs
  //console.log('=== inside angularjs ===');
  //console.log(appControllerError);

})

// ADDED
// Configuration for passing along console.log
// Example based on post by Ben Nadel
// http://www.bennadel.com/blog/2859-sending-angularjs-errors-to-new-relic-raygun-sentry-etc.htm
.config(
  function addReporting($provide) {
    // Provide an interceptor for the error workflow.
    $provide.decorator(
      "$exceptionHandler",
      function($delegate, errors) {
        // Return the new $exceptionHandler implementation which will
        // report the error to our internal error handler before passing
        // it off to the original...