-
Notifications
You must be signed in to change notification settings - Fork 8
10. Restrict Logging to specific methods
lwhiteley edited this page Sep 22, 2014
·
2 revisions
Add the logExProvider dependency to your AngularJS app to configure logging. Pass an array with the methods that should be enabled to the restrictLogMethods
method. $warn, $debug, $error
messages won't be displayed in the console
app.config(['logExProvider', function(logExProvider) {
logExProvider.restrictLogMethods(['log', 'info']);
}]);
This configuration is helpful when you want to only allow specific types of log messages to be sent to the console in a particular environment. For eg. Say we want to only allow error logs to be seen in production, then the following configuration will produce this result.
app.config(['logExProvider', function(logExProvider) {
logExProvider.enableLogging(true);
logExProvider.restrictLogMethods(['error']);
}]);
AngularLogExtender | License: MIT | Made with 💚