MCPcopy Create free account
hub / github.com/angular-ui/ui-router / $LogProvider

Function $LogProvider

test/angular/1.6/angular.js:14851–14965  ·  view source on GitHub ↗

* @ngdoc provider * @name $logProvider * @this * * @description * Use the `$logProvider` to configure how the application logs messages

()

Source from the content-addressed store, hash-verified

14849 * Use the `$logProvider` to configure how the application logs messages
14850 */
14851function $LogProvider() {
14852 var debug = true,
14853 self = this;
14854
14855 /**
14856 * @ngdoc method
14857 * @name $logProvider#debugEnabled
14858 * @description
14859 * @param {boolean=} flag enable or disable debug level messages
14860 * @returns {*} current value if used as getter or itself (chaining) if used as setter
14861 */
14862 this.debugEnabled = function(flag) {
14863 if (isDefined(flag)) {
14864 debug = flag;
14865 return this;
14866 } else {
14867 return debug;
14868 }
14869 };
14870
14871 this.$get = ['$window', function($window) {
14872 // Support: IE 9-11, Edge 12-14+
14873 // IE/Edge display errors in such a way that it requires the user to click in 4 places
14874 // to see the stack trace. There is no way to feature-detect it so there's a chance
14875 // of the user agent sniffing to go wrong but since it's only about logging, this shouldn't
14876 // break apps. Other browsers display errors in a sensible way and some of them map stack
14877 // traces along source maps if available so it makes sense to let browsers display it
14878 // as they want.
14879 var formatStackTrace = msie || /\bEdge\//.test($window.navigator && $window.navigator.userAgent);
14880
14881 return {
14882 /**
14883 * @ngdoc method
14884 * @name $log#log
14885 *
14886 * @description
14887 * Write a log message
14888 */
14889 log: consoleLog('log'),
14890
14891 /**
14892 * @ngdoc method
14893 * @name $log#info
14894 *
14895 * @description
14896 * Write an information message
14897 */
14898 info: consoleLog('info'),
14899
14900 /**
14901 * @ngdoc method
14902 * @name $log#warn
14903 *
14904 * @description
14905 * Write a warning message
14906 */
14907 warn: consoleLog('warn'),
14908

Callers

nothing calls this directly

Calls 2

isDefinedFunction · 0.70
consoleLogFunction · 0.70

Tested by

no test coverage detected