Skip to content

Instantly share code, notes, and snippets.

@JakeTheCorn
Created January 22, 2018 15:43
Show Gist options
  • Save JakeTheCorn/b9a95b549a3129eb34f1ceeb1e613353 to your computer and use it in GitHub Desktop.
Save JakeTheCorn/b9a95b549a3129eb34f1ceeb1e613353 to your computer and use it in GitHub Desktop.
// $log.log will call $log.debug instead which is globally configurable from the debugEnabled call
(function() {
'use strict';
angular.module('app')
.config(AppLogConfig);
AppLogConfig.$inject = ['$logProvider', 'IS_DEV_MODE', '$provide'];
function AppLogConfig($logProvider, IS_DEV_MODE, $provide) {
$provide.decorator('$log', ['$delegate', function ($delegate) {
$delegate.log = $delegate.debug;
return $delegate;
}]);
$logProvider.debugEnabled(IS_DEV_MODE);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment