index.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. <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>
  2. <head>
  3. <title>Log.js</title>
  4. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
  5. <style>body {
  6. margin: 0;
  7. padding: 0;
  8. font: 14px/1.5 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif;
  9. color: #252519;
  10. }
  11. a {
  12. color: #252519;
  13. }
  14. a:hover {
  15. text-decoration: underline;
  16. color: #19469D;
  17. }
  18. p {
  19. margin: 12px 0;
  20. }
  21. h1, h2, h3 {
  22. margin: 0;
  23. padding: 0;
  24. }
  25. table#source {
  26. width: 100%;
  27. border-collapse: collapse;
  28. }
  29. table#source td:first-child {
  30. padding: 30px 40px 30px 40px;
  31. vertical-align: top;
  32. }
  33. table#source td:first-child,
  34. table#source td:first-child pre {
  35. width: 450px;
  36. }
  37. table#source td:last-child {
  38. padding: 30px 0 30px 40px;
  39. border-left: 1px solid #E5E5EE;
  40. background: #F5F5FF;
  41. }
  42. table#source tr {
  43. border-bottom: 1px solid #E5E5EE;
  44. }
  45. table#source tr.filename {
  46. padding-top: 40px;
  47. border-top: 1px solid #E5E5EE;
  48. }
  49. table#source tr.filename td:first-child {
  50. text-transform: capitalize;
  51. }
  52. table#source tr.filename td:last-child {
  53. font-size: 12px;
  54. }
  55. table#source tr.filename h2 {
  56. margin: 0;
  57. padding: 0;
  58. cursor: pointer;
  59. }
  60. table#source tr.code h1,
  61. table#source tr.code h2,
  62. table#source tr.code h3 {
  63. margin-top: 30px;
  64. font-family: "Lucida Grande", "Helvetica Nueue", Arial, sans-serif;
  65. font-size: 18px;
  66. }
  67. table#source tr.code h2 {
  68. font-size: 16px;
  69. }
  70. table#source tr.code h3 {
  71. font-size: 14px;
  72. }
  73. table#source tr.code ul {
  74. margin: 15px 0 15px 35px;
  75. padding: 0;
  76. }
  77. table#source tr.code ul li {
  78. margin: 0;
  79. padding: 1px 0;
  80. }
  81. table#source tr.code ul li p {
  82. margin: 0;
  83. padding: 0;
  84. }
  85. table#source tr.code td:first-child pre {
  86. padding: 20px;
  87. }
  88. #ribbon {
  89. position: fixed;
  90. top: 0;
  91. right: 0;
  92. }
  93. code .string { color: #219161; }
  94. code .regexp { color: #219161; }
  95. code .keyword { color: #954121; }
  96. code .number { color: #19469D; }
  97. code .comment { color: #bbb; }
  98. code .this { color: #19469D; }</style>
  99. <script>
  100. $(function(){
  101. $('tr.code').hide();
  102. $('tr.filename').toggle(function(){
  103. $(this).nextUntil('.filename').fadeIn();
  104. }, function(){
  105. $(this).nextUntil('.filename').fadeOut();
  106. });
  107. });
  108. </script>
  109. </head>
  110. <body>
  111. <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">
  112. <td class="docs">
  113. <p>Initialize a <code>Loggeer</code> with the given log <code>level</code> defaulting
  114. to <strong>DEBUG</strong> and <code>stream</code> defaulting to <em>stdout</em>.</p>
  115. <h2></h2>
  116. <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>
  117. </td>
  118. <td class="code">
  119. <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>){
  120. <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>;
  121. <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>;
  122. };</code></pre>
  123. </td>
  124. </tr>
  125. <tr class="code">
  126. <td class="docs">
  127. <p>System is unusable.</p>
  128. <ul><li><p><strong>type</strong>: <em>Number</em></p></li></ul>
  129. </td>
  130. <td class="code">
  131. <pre><code><span class="variable">exports</span>.<span class="class">EMERGENCY</span> = <span class="number integer">0</span>;</code></pre>
  132. </td>
  133. </tr>
  134. <tr class="code">
  135. <td class="docs">
  136. <p>Action must be taken immediately.</p>
  137. <ul><li><p><strong>type</strong>: <em>Number</em></p></li></ul>
  138. </td>
  139. <td class="code">
  140. <pre><code><span class="variable">exports</span>.<span class="class">ALERT</span> = <span class="number integer">1</span>;</code></pre>
  141. </td>
  142. </tr>
  143. <tr class="code">
  144. <td class="docs">
  145. <p>Critical condition.</p>
  146. <ul><li><p><strong>type</strong>: <em>Number</em></p></li></ul>
  147. </td>
  148. <td class="code">
  149. <pre><code><span class="variable">exports</span>.<span class="class">CRITICAL</span> = <span class="number integer">2</span>;</code></pre>
  150. </td>
  151. </tr>
  152. <tr class="code">
  153. <td class="docs">
  154. <p>Error condition.</p>
  155. <ul><li><p><strong>type</strong>: <em>Number</em></p></li></ul>
  156. </td>
  157. <td class="code">
  158. <pre><code><span class="variable">exports</span>.<span class="class">ERROR</span> = <span class="number integer">3</span>;</code></pre>
  159. </td>
  160. </tr>
  161. <tr class="code">
  162. <td class="docs">
  163. <p>Warning condition.</p>
  164. <ul><li><p><strong>type</strong>: <em>Number</em></p></li></ul>
  165. </td>
  166. <td class="code">
  167. <pre><code><span class="variable">exports</span>.<span class="class">WARNING</span> = <span class="number integer">4</span>;</code></pre>
  168. </td>
  169. </tr>
  170. <tr class="code">
  171. <td class="docs">
  172. <p>Normal but significant condition.</p>
  173. <ul><li><p><strong>type</strong>: <em>Number</em></p></li></ul>
  174. </td>
  175. <td class="code">
  176. <pre><code><span class="variable">exports</span>.<span class="class">NOTICE</span> = <span class="number integer">5</span>;</code></pre>
  177. </td>
  178. </tr>
  179. <tr class="code">
  180. <td class="docs">
  181. <p>Purely informational message.</p>
  182. <ul><li><p><strong>type</strong>: <em>Number</em></p></li></ul>
  183. </td>
  184. <td class="code">
  185. <pre><code><span class="variable">exports</span>.<span class="class">INFO</span> = <span class="number integer">6</span>;</code></pre>
  186. </td>
  187. </tr>
  188. <tr class="code">
  189. <td class="docs">
  190. <p>Application debug messages.</p>
  191. <ul><li><p><strong>type</strong>: <em>Number</em></p></li></ul>
  192. </td>
  193. <td class="code">
  194. <pre><code><span class="variable">exports</span>.<span class="class">DEBUG</span> = <span class="number integer">7</span>;</code></pre>
  195. </td>
  196. </tr>
  197. <tr class="code">
  198. <td class="docs">
  199. <p>prototype.
  200. </p>
  201. </td>
  202. <td class="code">
  203. <pre><code><span class="class">Log</span>.<span class="variable">prototype</span> = {</code></pre>
  204. </td>
  205. </tr>
  206. <tr class="code">
  207. <td class="docs">
  208. <p>Log emergency <code>msg</code>.</p>
  209. <h2></h2>
  210. <ul><li><p><strong>param</strong>: <em>String</em> msg</p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>
  211. </td>
  212. <td class="code">
  213. <pre><code><span class="variable">emergency</span>: <span class="keyword">function</span>(<span class="variable">msg</span>){
  214. <span class="this">this</span>.<span class="variable">log</span>(<span class="string">'EMERGENCY'</span>, <span class="variable">msg</span>);
  215. },</code></pre>
  216. </td>
  217. </tr>
  218. <tr class="code">
  219. <td class="docs">
  220. <p>Log alert <code>msg</code>.</p>
  221. <h2></h2>
  222. <ul><li><p><strong>param</strong>: <em>String</em> msg</p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>
  223. </td>
  224. <td class="code">
  225. <pre><code><span class="variable">alert</span>: <span class="keyword">function</span>(<span class="variable">msg</span>){
  226. <span class="this">this</span>.<span class="variable">log</span>(<span class="string">'ALERT'</span>, <span class="variable">msg</span>);
  227. },</code></pre>
  228. </td>
  229. </tr>
  230. <tr class="code">
  231. <td class="docs">
  232. <p>Log critical <code>msg</code>.</p>
  233. <h2></h2>
  234. <ul><li><p><strong>param</strong>: <em>String</em> msg</p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>
  235. </td>
  236. <td class="code">
  237. <pre><code><span class="variable">critical</span>: <span class="keyword">function</span>(<span class="variable">msg</span>){
  238. <span class="this">this</span>.<span class="variable">log</span>(<span class="string">'CRITICAL'</span>, <span class="variable">msg</span>);
  239. },</code></pre>
  240. </td>
  241. </tr>
  242. <tr class="code">
  243. <td class="docs">
  244. <p>Log error <code>msg</code>.</p>
  245. <h2></h2>
  246. <ul><li><p><strong>param</strong>: <em>String</em> msg</p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>
  247. </td>
  248. <td class="code">
  249. <pre><code><span class="variable">error</span>: <span class="keyword">function</span>(<span class="variable">msg</span>){
  250. <span class="this">this</span>.<span class="variable">log</span>(<span class="string">'ERROR'</span>, <span class="variable">msg</span>);
  251. },</code></pre>
  252. </td>
  253. </tr>
  254. <tr class="code">
  255. <td class="docs">
  256. <p>Log warning <code>msg</code>.</p>
  257. <h2></h2>
  258. <ul><li><p><strong>param</strong>: <em>String</em> msg</p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>
  259. </td>
  260. <td class="code">
  261. <pre><code><span class="variable">warning</span>: <span class="keyword">function</span>(<span class="variable">msg</span>){
  262. <span class="this">this</span>.<span class="variable">log</span>(<span class="string">'WARNING'</span>, <span class="variable">msg</span>);
  263. },</code></pre>
  264. </td>
  265. </tr>
  266. <tr class="code">
  267. <td class="docs">
  268. <p>Log notice <code>msg</code>.</p>
  269. <h2></h2>
  270. <ul><li><p><strong>param</strong>: <em>String</em> msg</p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>
  271. </td>
  272. <td class="code">
  273. <pre><code><span class="variable">notice</span>: <span class="keyword">function</span>(<span class="variable">msg</span>){
  274. <span class="this">this</span>.<span class="variable">log</span>(<span class="string">'NOTICE'</span>, <span class="variable">msg</span>);
  275. },</code></pre>
  276. </td>
  277. </tr>
  278. <tr class="code">
  279. <td class="docs">
  280. <p>Log info <code>msg</code>.</p>
  281. <h2></h2>
  282. <ul><li><p><strong>param</strong>: <em>String</em> msg</p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>
  283. </td>
  284. <td class="code">
  285. <pre><code><span class="variable">info</span>: <span class="keyword">function</span>(<span class="variable">msg</span>){
  286. <span class="this">this</span>.<span class="variable">log</span>(<span class="string">'INFO'</span>, <span class="variable">msg</span>);
  287. },</code></pre>
  288. </td>
  289. </tr>
  290. <tr class="code">
  291. <td class="docs">
  292. <p>Log debug <code>msg</code>.</p>
  293. <h2></h2>
  294. <ul><li><p><strong>param</strong>: <em>String</em> msg</p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>
  295. </td>
  296. <td class="code">
  297. <pre><code><span class="variable">debug</span>: <span class="keyword">function</span>(<span class="variable">msg</span>){
  298. <span class="this">this</span>.<span class="variable">log</span>(<span class="string">'DEBUG'</span>, <span class="variable">msg</span>);
  299. }
  300. };</code></pre>
  301. </td>
  302. </tr> </body>
  303. </html></tbody></table>