123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329 |
- <a href="http://github.com/visionmedia/log.js"><img alt="Fork me on GitHub" id="ribbon" src="http://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a><html>
- <head>
- <title>Log.js</title>
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
- <style>body {
- margin: 0;
- padding: 0;
- font: 14px/1.5 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif;
- color: #252519;
- }
- a {
- color: #252519;
- }
- a:hover {
- text-decoration: underline;
- color: #19469D;
- }
- p {
- margin: 12px 0;
- }
- h1, h2, h3 {
- margin: 0;
- padding: 0;
- }
- table#source {
- width: 100%;
- border-collapse: collapse;
- }
- table#source td:first-child {
- padding: 30px 40px 30px 40px;
- vertical-align: top;
- }
- table#source td:first-child,
- table#source td:first-child pre {
- width: 450px;
- }
- table#source td:last-child {
- padding: 30px 0 30px 40px;
- border-left: 1px solid #E5E5EE;
- background: #F5F5FF;
- }
- table#source tr {
- border-bottom: 1px solid #E5E5EE;
- }
- table#source tr.filename {
- padding-top: 40px;
- border-top: 1px solid #E5E5EE;
- }
- table#source tr.filename td:first-child {
- text-transform: capitalize;
- }
- table#source tr.filename td:last-child {
- font-size: 12px;
- }
- table#source tr.filename h2 {
- margin: 0;
- padding: 0;
- cursor: pointer;
- }
- table#source tr.code h1,
- table#source tr.code h2,
- table#source tr.code h3 {
- margin-top: 30px;
- font-family: "Lucida Grande", "Helvetica Nueue", Arial, sans-serif;
- font-size: 18px;
- }
- table#source tr.code h2 {
- font-size: 16px;
- }
- table#source tr.code h3 {
- font-size: 14px;
- }
- table#source tr.code ul {
- margin: 15px 0 15px 35px;
- padding: 0;
- }
- table#source tr.code ul li {
- margin: 0;
- padding: 1px 0;
- }
- table#source tr.code ul li p {
- margin: 0;
- padding: 0;
- }
- table#source tr.code td:first-child pre {
- padding: 20px;
- }
- #ribbon {
- position: fixed;
- top: 0;
- right: 0;
- }
- code .string { color: #219161; }
- code .regexp { color: #219161; }
- code .keyword { color: #954121; }
- code .number { color: #19469D; }
- code .comment { color: #bbb; }
- code .this { color: #19469D; }</style>
- <script>
- $(function(){
- $('tr.code').hide();
- $('tr.filename').toggle(function(){
- $(this).nextUntil('.filename').fadeIn();
- }, function(){
- $(this).nextUntil('.filename').fadeOut();
- });
- });
- </script>
- </head>
- <body>
- <table id="source"><tbody><tr><td><h1>Log.js</h1><p>Tiny logger for <a href="http://nodejs.org">NodeJS</a>.</p></td><td></td></tr><tr class="filename"><td><h2 id="lib/log.js"><a href="#">log</a></h2></td><td>lib/log.js</td></tr><tr class="code">
- <td class="docs">
- <p>Initialize a <code>Loggeer</code> with the given log <code>level</code> defaulting
- to <strong>DEBUG</strong> and <code>stream</code> defaulting to <em>stdout</em>.</p>
- <h2></h2>
- <ul><li><p><strong>param</strong>: <em>Number</em> level </p></li><li><p><strong>param</strong>: <em>Object</em> stream </p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>
- </td>
- <td class="code">
- <pre><code><span class="keyword">var</span> <span class="class">Log</span> = <span class="variable">exports</span> = <span class="variable">module</span>.<span class="variable">exports</span> = <span class="keyword">function</span> <span class="class">Log</span>(<span class="variable">level</span>, <span class="variable">stream</span>){
- <span class="this">this</span>.<span class="variable">level</span> = <span class="variable">level</span> || <span class="variable">exports</span>.<span class="class">DEBUG</span>;
- <span class="this">this</span>.<span class="variable">stream</span> = <span class="variable">stream</span> || <span class="variable">process</span>.<span class="variable">stdout</span>;
- };</code></pre>
- </td>
- </tr>
- <tr class="code">
- <td class="docs">
- <p>System is unusable.</p>
- <ul><li><p><strong>type</strong>: <em>Number</em></p></li></ul>
- </td>
- <td class="code">
- <pre><code><span class="variable">exports</span>.<span class="class">EMERGENCY</span> = <span class="number integer">0</span>;</code></pre>
- </td>
- </tr>
- <tr class="code">
- <td class="docs">
- <p>Action must be taken immediately.</p>
- <ul><li><p><strong>type</strong>: <em>Number</em></p></li></ul>
- </td>
- <td class="code">
- <pre><code><span class="variable">exports</span>.<span class="class">ALERT</span> = <span class="number integer">1</span>;</code></pre>
- </td>
- </tr>
- <tr class="code">
- <td class="docs">
- <p>Critical condition.</p>
- <ul><li><p><strong>type</strong>: <em>Number</em></p></li></ul>
- </td>
- <td class="code">
- <pre><code><span class="variable">exports</span>.<span class="class">CRITICAL</span> = <span class="number integer">2</span>;</code></pre>
- </td>
- </tr>
- <tr class="code">
- <td class="docs">
- <p>Error condition.</p>
- <ul><li><p><strong>type</strong>: <em>Number</em></p></li></ul>
- </td>
- <td class="code">
- <pre><code><span class="variable">exports</span>.<span class="class">ERROR</span> = <span class="number integer">3</span>;</code></pre>
- </td>
- </tr>
- <tr class="code">
- <td class="docs">
- <p>Warning condition.</p>
- <ul><li><p><strong>type</strong>: <em>Number</em></p></li></ul>
- </td>
- <td class="code">
- <pre><code><span class="variable">exports</span>.<span class="class">WARNING</span> = <span class="number integer">4</span>;</code></pre>
- </td>
- </tr>
- <tr class="code">
- <td class="docs">
- <p>Normal but significant condition.</p>
- <ul><li><p><strong>type</strong>: <em>Number</em></p></li></ul>
- </td>
- <td class="code">
- <pre><code><span class="variable">exports</span>.<span class="class">NOTICE</span> = <span class="number integer">5</span>;</code></pre>
- </td>
- </tr>
- <tr class="code">
- <td class="docs">
- <p>Purely informational message.</p>
- <ul><li><p><strong>type</strong>: <em>Number</em></p></li></ul>
- </td>
- <td class="code">
- <pre><code><span class="variable">exports</span>.<span class="class">INFO</span> = <span class="number integer">6</span>;</code></pre>
- </td>
- </tr>
- <tr class="code">
- <td class="docs">
- <p>Application debug messages.</p>
- <ul><li><p><strong>type</strong>: <em>Number</em></p></li></ul>
- </td>
- <td class="code">
- <pre><code><span class="variable">exports</span>.<span class="class">DEBUG</span> = <span class="number integer">7</span>;</code></pre>
- </td>
- </tr>
- <tr class="code">
- <td class="docs">
- <p>prototype.
- </p>
- </td>
- <td class="code">
- <pre><code><span class="class">Log</span>.<span class="variable">prototype</span> = {</code></pre>
- </td>
- </tr>
- <tr class="code">
- <td class="docs">
- <p>Log emergency <code>msg</code>.</p>
- <h2></h2>
- <ul><li><p><strong>param</strong>: <em>String</em> msg</p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>
- </td>
- <td class="code">
- <pre><code><span class="variable">emergency</span>: <span class="keyword">function</span>(<span class="variable">msg</span>){
- <span class="this">this</span>.<span class="variable">log</span>(<span class="string">'EMERGENCY'</span>, <span class="variable">msg</span>);
- },</code></pre>
- </td>
- </tr>
- <tr class="code">
- <td class="docs">
- <p>Log alert <code>msg</code>.</p>
- <h2></h2>
- <ul><li><p><strong>param</strong>: <em>String</em> msg</p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>
- </td>
- <td class="code">
- <pre><code><span class="variable">alert</span>: <span class="keyword">function</span>(<span class="variable">msg</span>){
- <span class="this">this</span>.<span class="variable">log</span>(<span class="string">'ALERT'</span>, <span class="variable">msg</span>);
- },</code></pre>
- </td>
- </tr>
- <tr class="code">
- <td class="docs">
- <p>Log critical <code>msg</code>.</p>
- <h2></h2>
- <ul><li><p><strong>param</strong>: <em>String</em> msg</p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>
- </td>
- <td class="code">
- <pre><code><span class="variable">critical</span>: <span class="keyword">function</span>(<span class="variable">msg</span>){
- <span class="this">this</span>.<span class="variable">log</span>(<span class="string">'CRITICAL'</span>, <span class="variable">msg</span>);
- },</code></pre>
- </td>
- </tr>
- <tr class="code">
- <td class="docs">
- <p>Log error <code>msg</code>.</p>
- <h2></h2>
- <ul><li><p><strong>param</strong>: <em>String</em> msg</p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>
- </td>
- <td class="code">
- <pre><code><span class="variable">error</span>: <span class="keyword">function</span>(<span class="variable">msg</span>){
- <span class="this">this</span>.<span class="variable">log</span>(<span class="string">'ERROR'</span>, <span class="variable">msg</span>);
- },</code></pre>
- </td>
- </tr>
- <tr class="code">
- <td class="docs">
- <p>Log warning <code>msg</code>.</p>
- <h2></h2>
- <ul><li><p><strong>param</strong>: <em>String</em> msg</p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>
- </td>
- <td class="code">
- <pre><code><span class="variable">warning</span>: <span class="keyword">function</span>(<span class="variable">msg</span>){
- <span class="this">this</span>.<span class="variable">log</span>(<span class="string">'WARNING'</span>, <span class="variable">msg</span>);
- },</code></pre>
- </td>
- </tr>
- <tr class="code">
- <td class="docs">
- <p>Log notice <code>msg</code>.</p>
- <h2></h2>
- <ul><li><p><strong>param</strong>: <em>String</em> msg</p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>
- </td>
- <td class="code">
- <pre><code><span class="variable">notice</span>: <span class="keyword">function</span>(<span class="variable">msg</span>){
- <span class="this">this</span>.<span class="variable">log</span>(<span class="string">'NOTICE'</span>, <span class="variable">msg</span>);
- },</code></pre>
- </td>
- </tr>
- <tr class="code">
- <td class="docs">
- <p>Log info <code>msg</code>.</p>
- <h2></h2>
- <ul><li><p><strong>param</strong>: <em>String</em> msg</p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>
- </td>
- <td class="code">
- <pre><code><span class="variable">info</span>: <span class="keyword">function</span>(<span class="variable">msg</span>){
- <span class="this">this</span>.<span class="variable">log</span>(<span class="string">'INFO'</span>, <span class="variable">msg</span>);
- },</code></pre>
- </td>
- </tr>
- <tr class="code">
- <td class="docs">
- <p>Log debug <code>msg</code>.</p>
- <h2></h2>
- <ul><li><p><strong>param</strong>: <em>String</em> msg</p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>
- </td>
- <td class="code">
- <pre><code><span class="variable">debug</span>: <span class="keyword">function</span>(<span class="variable">msg</span>){
- <span class="this">this</span>.<span class="variable">log</span>(<span class="string">'DEBUG'</span>, <span class="variable">msg</span>);
- }
- };</code></pre>
- </td>
- </tr> </body>
- </html></tbody></table>
|