$log service is recommended over console.log for AngularJS apps. One common use case for such logging is seeing debug print when running tests. The problem is, angular-mocks silences $log by default replacing it by a mock. Well, I do sometimes need to test my debug print, but I just need to see it much more often. The problem is, the default behavior insists on using dummy logging and I don't even see a proper way to revert back to real $log. I've made a jsfiddle example to illustrate it, try running it while looking at devtools console http://jsfiddle.net/ivan4th/EnvL9/
var myApp = angular.module('myApp', []);
describe('myApp', function () {
var element, rootScope;
beforeEach(module('myApp'));
it('does something', inject(function ($log) {
$log.log("this message gets eaten by angular-mocks");
console.log("this message is visible though");
}));
});
The first message is skipped, while second is shown as expected. Why such strange behavior is used and is there any way to fix it besides not using $log?