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

Function $LogProvider

test/angular/1.7/angular.js:15460–15574  ·  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

15458 * Use the `$logProvider` to configure how the application logs messages
15459 */
15460function $LogProvider() {
15461 var debug = true,
15462 self = this;
15463
15464 /**
15465 * @ngdoc method
15466 * @name $logProvider#debugEnabled
15467 * @description
15468 * @param {boolean=} flag enable or disable debug level messages
15469 * @returns {*} current value if used as getter or itself (chaining) if used as setter
15470 */
15471 this.debugEnabled = function(flag) {
15472 if (isDefined(flag)) {
15473 debug = flag;
15474 return this;
15475 } else {
15476 return debug;
15477 }
15478 };
15479
15480 this.$get = ['$window', function($window) {
15481 // Support: IE 9-11, Edge 12-14+
15482 // IE/Edge display errors in such a way that it requires the user to click in 4 places
15483 // to see the stack trace. There is no way to feature-detect it so there's a chance
15484 // of the user agent sniffing to go wrong but since it's only about logging, this shouldn't
15485 // break apps. Other browsers display errors in a sensible way and some of them map stack
15486 // traces along source maps if available so it makes sense to let browsers display it
15487 // as they want.
15488 var formatStackTrace = msie || /\bEdge\//.test($window.navigator && $window.navigator.userAgent);
15489
15490 return {
15491 /**
15492 * @ngdoc method
15493 * @name $log#log
15494 *
15495 * @description
15496 * Write a log message
15497 */
15498 log: consoleLog('log'),
15499
15500 /**
15501 * @ngdoc method
15502 * @name $log#info
15503 *
15504 * @description
15505 * Write an information message
15506 */
15507 info: consoleLog('info'),
15508
15509 /**
15510 * @ngdoc method
15511 * @name $log#warn
15512 *
15513 * @description
15514 * Write a warning message
15515 */
15516 warn: consoleLog('warn'),
15517

Callers

nothing calls this directly

Calls 2

isDefinedFunction · 0.70
consoleLogFunction · 0.70

Tested by

no test coverage detected