mirror of
https://github.com/abrendan/MicDropMessages.git
synced 2025-08-25 05:52:02 +02:00
Initial commit
This commit is contained in:
27
node_modules/log/History.md
generated
vendored
Normal file
27
node_modules/log/History.md
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
|
||||
1.4.0 / 2013-05-02
|
||||
==================
|
||||
|
||||
* use util#format for message formatting
|
||||
|
||||
1.3.0 / 2012-02-10
|
||||
==================
|
||||
|
||||
* Changed to use local time zone instead of GMT [thakkar-rushikesh]
|
||||
|
||||
1.2.0 / 2011-05-23
|
||||
==================
|
||||
|
||||
* Added sprintf-like `%s` support
|
||||
|
||||
1.1.1 / 2010-09-26
|
||||
==================
|
||||
|
||||
* Fixed `Log()` initialization without giving a stream [bentruyman]
|
||||
|
||||
1.1.0 / 2010-09-26
|
||||
==================
|
||||
|
||||
* Added streaming reader capabilities (_pass a readable stream_)
|
||||
* Added `Log()` log level as string support (_alternative of constants_)
|
||||
* Added _./index.js_ so people can clone
|
14
node_modules/log/Makefile
generated
vendored
Normal file
14
node_modules/log/Makefile
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
docs: index.html
|
||||
|
||||
index.html: lib/log.js
|
||||
dox \
|
||||
--title "Log.js" \
|
||||
--desc "Tiny logger for [NodeJS](http://nodejs.org)." \
|
||||
--ribbon "http://github.com/visionmedia/log.js" \
|
||||
lib/log.js > $@
|
||||
|
||||
docclean:
|
||||
rm -f index.html
|
||||
|
||||
.PHONY: docs docclean
|
100
node_modules/log/Readme.md
generated
vendored
Normal file
100
node_modules/log/Readme.md
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
|
||||
# Log.js
|
||||
|
||||
Light-weight logging for [NodeJS](http://nodejs.org), including a
|
||||
streaming log reader.
|
||||
|
||||
## Installation
|
||||
|
||||
$ npm install log
|
||||
|
||||
## Example
|
||||
|
||||
Log level defaults to __DEBUG__ however here we specify __info__, and the stream defaults to _stdout_:
|
||||
|
||||
var Log = require('log')
|
||||
, log = new Log('info');
|
||||
|
||||
log.debug('preparing email');
|
||||
log.info('sending email');
|
||||
log.error('failed to send email');
|
||||
|
||||
Specifying a specific stream:
|
||||
|
||||
var fs = require('fs')
|
||||
, Log = require('log')
|
||||
, log = new Log('debug', fs.createWriteStream('my.log'));
|
||||
|
||||
Instead of the log level constants, you may also supply a string:
|
||||
|
||||
var Log = require('log')
|
||||
, log = new Log('warning');
|
||||
|
||||
We can also use `%s` much like `console.log()` to pass arguments:
|
||||
|
||||
log.error('oh no, failed to send mail to %s.', user.email);
|
||||
|
||||
## Reader
|
||||
|
||||
To stream a log, simply pass a readable stream instead of a writable:
|
||||
|
||||
var Log = require('log')
|
||||
, fs = require('fs')
|
||||
, stream = fs.createReadStream(__dirname + '/file.log')
|
||||
, log = new Log('debug', stream);
|
||||
|
||||
log.on('line', function(line){
|
||||
console.log(line);
|
||||
});
|
||||
|
||||
__Note: log.js assumes utf8 encoded data.__
|
||||
Example stdout:
|
||||
|
||||
{ date: Sun, 26 Sep 2010 01:26:14 GMT
|
||||
, level: 1
|
||||
, levelString: 'ALERT'
|
||||
, msg: 'a alert message'
|
||||
}
|
||||
{ date: Sun, 26 Sep 2010 01:26:14 GMT
|
||||
, level: 0
|
||||
, levelString: 'EMERGENCY'
|
||||
, msg: 'a emergency message'
|
||||
}
|
||||
|
||||
## Log Levels
|
||||
|
||||
Mirror that of syslog:
|
||||
|
||||
- 0 __EMERGENCY__ system is unusable
|
||||
- 1 __ALERT__ action must be taken immediately
|
||||
- 2 __CRITICAL__ the system is in critical condition
|
||||
- 3 __ERROR__ error condition
|
||||
- 4 __WARNING__ warning condition
|
||||
- 5 __NOTICE__ a normal but significant condition
|
||||
- 6 __INFO__ a purely informational message
|
||||
- 7 __DEBUG__ messages to debug an application
|
||||
|
||||
## License
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2009-2010 TJ Holowaychuk <tj@vision-media.ca>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
18
node_modules/log/examples/file.js
generated
vendored
Normal file
18
node_modules/log/examples/file.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Log = require('../lib/log')
|
||||
, fs = require('fs')
|
||||
, stream = fs.createWriteStream(__dirname + '/file.log', { flags: 'a' })
|
||||
, log = new Log('debug', stream);
|
||||
|
||||
log.debug('a debug message');
|
||||
log.info('a info message');
|
||||
log.notice('a notice message');
|
||||
log.warning('a warning message');
|
||||
log.error('a error message');
|
||||
log.critical('a critical message');
|
||||
log.alert('a alert message');
|
||||
log.emergency('a emergency message');
|
16
node_modules/log/examples/file.log
generated
vendored
Normal file
16
node_modules/log/examples/file.log
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
[Sun, 26 Sep 2010 01:26:14 GMT] DEBUG a debug message
|
||||
[Sun, 26 Sep 2010 01:26:14 GMT] INFO a info message
|
||||
[Sun, 26 Sep 2010 01:26:14 GMT] NOTICE a notice message
|
||||
[Sun, 26 Sep 2010 01:26:14 GMT] WARNING a warning message
|
||||
[Sun, 26 Sep 2010 01:26:14 GMT] ERROR a error message
|
||||
[Sun, 26 Sep 2010 01:26:14 GMT] CRITICAL a critical message
|
||||
[Sun, 26 Sep 2010 01:26:14 GMT] ALERT a alert message
|
||||
[Sun, 26 Sep 2010 01:26:14 GMT] EMERGENCY a emergency message
|
||||
[Thu, 03 Feb 2011 04:54:39 GMT] DEBUG a debug message
|
||||
[Thu, 03 Feb 2011 04:54:39 GMT] INFO a info message
|
||||
[Thu, 03 Feb 2011 04:54:39 GMT] NOTICE a notice message
|
||||
[Thu, 03 Feb 2011 04:54:39 GMT] WARNING a warning message
|
||||
[Thu, 03 Feb 2011 04:54:39 GMT] ERROR a error message
|
||||
[Thu, 03 Feb 2011 04:54:39 GMT] CRITICAL a critical message
|
||||
[Thu, 03 Feb 2011 04:54:39 GMT] ALERT a alert message
|
||||
[Thu, 03 Feb 2011 04:54:39 GMT] EMERGENCY a emergency message
|
15
node_modules/log/examples/reader.js
generated
vendored
Normal file
15
node_modules/log/examples/reader.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Log = require('../lib/log')
|
||||
, fs = require('fs')
|
||||
, stream = fs.createReadStream(__dirname + '/file.log')
|
||||
, log = new Log('debug', stream);
|
||||
|
||||
log.on('line', function(line){
|
||||
console.log(line);
|
||||
}).on('end', function(){
|
||||
console.log('done');
|
||||
});;
|
17
node_modules/log/examples/stdout.js
generated
vendored
Normal file
17
node_modules/log/examples/stdout.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Log = require('../lib/log')
|
||||
, log = new Log('notice');
|
||||
|
||||
log.debug('a debug message');
|
||||
log.info('a info message');
|
||||
log.notice('a notice message');
|
||||
log.warning('a warning message');
|
||||
log.error('a error message');
|
||||
log.critical('a critical message');
|
||||
log.alert('a alert message');
|
||||
log.emergency('a emergency %s', 'message');
|
||||
log.emergency('a really %s emergency %s', 'bad', 'message');
|
329
node_modules/log/index.html
generated
vendored
Normal file
329
node_modules/log/index.html
generated
vendored
Normal file
@@ -0,0 +1,329 @@
|
||||
<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>
|
2
node_modules/log/index.js
generated
vendored
Normal file
2
node_modules/log/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
module.exports = require('./lib/log');
|
251
node_modules/log/lib/log.js
generated
vendored
Normal file
251
node_modules/log/lib/log.js
generated
vendored
Normal file
@@ -0,0 +1,251 @@
|
||||
/*!
|
||||
* Log.js
|
||||
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var fmt = require('util').format;
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
|
||||
/**
|
||||
* Initialize a `Loggeer` with the given log `level` defaulting
|
||||
* to __DEBUG__ and `stream` defaulting to _stdout_.
|
||||
*
|
||||
* @param {Number} level
|
||||
* @param {Object} stream
|
||||
* @api public
|
||||
*/
|
||||
|
||||
var Log = exports = module.exports = function Log(level, stream){
|
||||
if ('string' == typeof level) level = exports[level.toUpperCase()];
|
||||
this.level = level || exports.DEBUG;
|
||||
this.stream = stream || process.stdout;
|
||||
if (this.stream.readable) this.read();
|
||||
};
|
||||
|
||||
/**
|
||||
* System is unusable.
|
||||
*
|
||||
* @type Number
|
||||
*/
|
||||
|
||||
exports.EMERGENCY = 0;
|
||||
|
||||
/**
|
||||
* Action must be taken immediately.
|
||||
*
|
||||
* @type Number
|
||||
*/
|
||||
|
||||
exports.ALERT = 1;
|
||||
|
||||
/**
|
||||
* Critical condition.
|
||||
*
|
||||
* @type Number
|
||||
*/
|
||||
|
||||
exports.CRITICAL = 2;
|
||||
|
||||
/**
|
||||
* Error condition.
|
||||
*
|
||||
* @type Number
|
||||
*/
|
||||
|
||||
exports.ERROR = 3;
|
||||
|
||||
/**
|
||||
* Warning condition.
|
||||
*
|
||||
* @type Number
|
||||
*/
|
||||
|
||||
exports.WARNING = 4;
|
||||
|
||||
/**
|
||||
* Normal but significant condition.
|
||||
*
|
||||
* @type Number
|
||||
*/
|
||||
|
||||
exports.NOTICE = 5;
|
||||
|
||||
/**
|
||||
* Purely informational message.
|
||||
*
|
||||
* @type Number
|
||||
*/
|
||||
|
||||
exports.INFO = 6;
|
||||
|
||||
/**
|
||||
* Application debug messages.
|
||||
*
|
||||
* @type Number
|
||||
*/
|
||||
|
||||
exports.DEBUG = 7;
|
||||
|
||||
/**
|
||||
* prototype.
|
||||
*/
|
||||
|
||||
Log.prototype = {
|
||||
|
||||
/**
|
||||
* Start emitting "line" events.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
read: function(){
|
||||
var buf = ''
|
||||
, self = this
|
||||
, stream = this.stream;
|
||||
|
||||
stream.setEncoding('utf8');
|
||||
stream.on('data', function(chunk){
|
||||
buf += chunk;
|
||||
if ('\n' != buf[buf.length - 1]) return;
|
||||
buf.split('\n').map(function(line){
|
||||
if (!line.length) return;
|
||||
try {
|
||||
var captures = line.match(/^\[([^\]]+)\] (\w+) (.*)/);
|
||||
var obj = {
|
||||
date: new Date(captures[1])
|
||||
, level: exports[captures[2]]
|
||||
, levelString: captures[2]
|
||||
, msg: captures[3]
|
||||
};
|
||||
self.emit('line', obj);
|
||||
} catch (err) {
|
||||
// Ignore
|
||||
}
|
||||
});
|
||||
buf = '';
|
||||
});
|
||||
|
||||
stream.on('end', function(){
|
||||
self.emit('end');
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Log output message.
|
||||
*
|
||||
* @param {String} levelStr
|
||||
* @param {Array} args
|
||||
* @api private
|
||||
*/
|
||||
|
||||
log: function(levelStr, args) {
|
||||
if (exports[levelStr] <= this.level) {
|
||||
var msg = fmt.apply(null, args);
|
||||
this.stream.write(
|
||||
'[' + new Date + ']'
|
||||
+ ' ' + levelStr
|
||||
+ ' ' + msg
|
||||
+ '\n'
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Log emergency `msg`.
|
||||
*
|
||||
* @param {String} msg
|
||||
* @api public
|
||||
*/
|
||||
|
||||
emergency: function(msg){
|
||||
this.log('EMERGENCY', arguments);
|
||||
},
|
||||
|
||||
/**
|
||||
* Log alert `msg`.
|
||||
*
|
||||
* @param {String} msg
|
||||
* @api public
|
||||
*/
|
||||
|
||||
alert: function(msg){
|
||||
this.log('ALERT', arguments);
|
||||
},
|
||||
|
||||
/**
|
||||
* Log critical `msg`.
|
||||
*
|
||||
* @param {String} msg
|
||||
* @api public
|
||||
*/
|
||||
|
||||
critical: function(msg){
|
||||
this.log('CRITICAL', arguments);
|
||||
},
|
||||
|
||||
/**
|
||||
* Log error `msg`.
|
||||
*
|
||||
* @param {String} msg
|
||||
* @api public
|
||||
*/
|
||||
|
||||
error: function(msg){
|
||||
this.log('ERROR', arguments);
|
||||
},
|
||||
|
||||
/**
|
||||
* Log warning `msg`.
|
||||
*
|
||||
* @param {String} msg
|
||||
* @api public
|
||||
*/
|
||||
|
||||
warning: function(msg){
|
||||
this.log('WARNING', arguments);
|
||||
},
|
||||
|
||||
/**
|
||||
* Log notice `msg`.
|
||||
*
|
||||
* @param {String} msg
|
||||
* @api public
|
||||
*/
|
||||
|
||||
notice: function(msg){
|
||||
this.log('NOTICE', arguments);
|
||||
},
|
||||
|
||||
/**
|
||||
* Log info `msg`.
|
||||
*
|
||||
* @param {String} msg
|
||||
* @api public
|
||||
*/
|
||||
|
||||
info: function(msg){
|
||||
this.log('INFO', arguments);
|
||||
},
|
||||
|
||||
/**
|
||||
* Log debug `msg`.
|
||||
*
|
||||
* @param {String} msg
|
||||
* @api public
|
||||
*/
|
||||
|
||||
debug: function(msg){
|
||||
this.log('DEBUG', arguments);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Inherit from `EventEmitter`.
|
||||
*/
|
||||
|
||||
Log.prototype.__proto__ = EventEmitter.prototype;
|
42
node_modules/log/package.json
generated
vendored
Normal file
42
node_modules/log/package.json
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"_from": "log@^1.4.0",
|
||||
"_id": "log@1.4.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-S6HYkP3iSbAx3KA7w36q8yVlbxw=",
|
||||
"_location": "/log",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "log@^1.4.0",
|
||||
"name": "log",
|
||||
"escapedName": "log",
|
||||
"rawSpec": "^1.4.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.4.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/server"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/log/-/log-1.4.0.tgz",
|
||||
"_shasum": "4ba1d890fde249b031dca03bc37eaaf325656f1c",
|
||||
"_spec": "log@^1.4.0",
|
||||
"_where": "/home/runner/Socketio-Chat-Template/node_modules/server",
|
||||
"author": {
|
||||
"name": "TJ Holowaychuk",
|
||||
"email": "tj@vision-media.ca"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Tiny logger with streaming reader",
|
||||
"engines": {
|
||||
"node": ">= 0.2.0"
|
||||
},
|
||||
"keywords": [
|
||||
"log",
|
||||
"logger"
|
||||
],
|
||||
"main": "./lib/log.js",
|
||||
"name": "log",
|
||||
"version": "1.4.0"
|
||||
}
|
Reference in New Issue
Block a user