- config
- $logProvider
Turn off logging with $logProvider
examples/angular/logging_off.js
angular.module('DemoApp', []) .config(['$logProvider', function($logProvider) { $logProvider.debugEnabled(false); // turns off the calls to $log.debug, but not the others }]) .controller('DemoController', ['$log', function($log) { $log.debug("Some debug"); $log.info("Some info"); $log.log("Some log"); $log.warn("Some warning"); $log.error("Some error"); }]);
examples/angular/logging_off.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=yes"> <script src="angular.min.js"></script> <script src="logging_off.js"></script> </head> <body ng-app="DemoApp" ng-controller="DemoController"> <h1>Main Title</h1> </body> </html>