forked from angular/code.angularjs.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathng.$log.html
69 lines (69 loc) · 3.23 KB
/
ng.$log.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<a href="http://github.com/angular/angular.js/tree/v1.2.3/src/ng/log.js#L3" class="view-source btn btn-action"><i class="icon-zoom-in"> </i> View source</a><a href="http://github.com/angular/angular.js/edit/master/src/ng/log.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$log</code>
<div><span class="hint">service in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><h2 id="description">Description</h2>
<div class="description"><div class="ng-log-page"><p>Simple service for logging. Default implementation safely writes the message
into the browser's console (if present).</p>
<p>The main purpose of this service is to simplify debugging and troubleshooting.</p>
<p>The default is to log <code>debug</code> messages. You can use
<a href="api/ng.$logProvider"><code>ng.$logProvider#debugEnabled</code></a> to change this.</p>
</div></div>
<h2 id="dependencies">Dependencies</h2>
<ul class="dependencies"><li><code ng:non-bindable=""><a href="api/ng.$window">$window</a></code>
</li>
</ul>
<div class="member method"><h2 id="methods">Methods</h2>
<ul class="methods"><li><h3 id="methods_debug">debug()</h3>
<div class="debug"><div class="ng-log-debug-page"><p>Write a debug message</p>
</div></div>
</li>
<li><h3 id="methods_error">error()</h3>
<div class="error"><div class="ng-log-error-page"><p>Write an error message</p>
</div></div>
</li>
<li><h3 id="methods_info">info()</h3>
<div class="info"><div class="ng-log-info-page"><p>Write an information message</p>
</div></div>
</li>
<li><h3 id="methods_log">log()</h3>
<div class="log"><div class="ng-log-log-page"><p>Write a log message</p>
</div></div>
</li>
<li><h3 id="methods_warn">warn()</h3>
<div class="warn"><div class="ng-log-warn-page"><p>Write a warning message</p>
</div></div>
</li>
</ul>
</div>
<h2 id="example">Example</h2>
<div class="example"><div class="ng-log-page"><h4 id="example_source">Source</h4>
<div source-edit="" source-edit-deps="angular.js script.js" source-edit-html="index.html-145" source-edit-css="" source-edit-js="script.js-144" source-edit-json="" source-edit-unit="" source-edit-scenario=""></div>
<div class="tabbable"><div class="tab-pane" title="index.html">
<pre class="prettyprint linenums" ng-set-text="index.html-145" ng-html-wrap=" angular.js script.js"></pre>
<script type="text/ng-template" id="index.html-145">
<div ng-controller="LogCtrl">
<p>Reload this page with open console, enter text and hit the log button...</p>
Message:
<input type="text" ng-model="message"/>
<button ng-click="$log.log(message)">log</button>
<button ng-click="$log.warn(message)">warn</button>
<button ng-click="$log.info(message)">info</button>
<button ng-click="$log.error(message)">error</button>
</div>
</script>
</div>
<div class="tab-pane" title="script.js">
<pre class="prettyprint linenums" ng-set-text="script.js-144"></pre>
<script type="text/ng-template" id="script.js-144">
function LogCtrl($scope, $log) {
$scope.$log = $log;
$scope.message = 'Hello World!';
}
</script>
</div>
</div><h4 id="example_demo">Demo</h4>
<div class="well doc-example-live animate-container" ng-embed-app="" ng-set-html="index.html-145" ng-eval-javascript="script.js-144"></div>
</div></div>
</div>