-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Contra
committed
Sep 17, 2011
0 parents
commit 5f9b8de
Showing
7 changed files
with
129 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.DS_Store | ||
*.log | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Copyright (c) 2011 Contra <contra@australia.edu> | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
**node-log is a simple logger for NodeJS** | ||
|
||
|
||
## Installation | ||
|
||
To install node-log, use [npm](http://github.com/isaacs/npm): | ||
|
||
$ npm install node-log | ||
|
||
## Usage | ||
|
||
node-log will automatically detect the application name via your package.json file. | ||
``` | ||
var log = require('node-log'); | ||
log.log('test'); | ||
log.error('erruh!'); | ||
log.debug('secrecy'); | ||
log.warn('watch out bruh'); | ||
log.info('seriously watch out'); | ||
``` | ||
|
||
## Contributors | ||
|
||
- [Contra](https://github.com/Contra) | ||
|
||
## LICENSE | ||
|
||
(MIT License) | ||
|
||
Copyright (c) 2011 Fractal <contact@wearefractal.com> | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
require 'colors' | ||
pack = require('./package').load() | ||
|
||
module.exports = | ||
log: (str) -> | ||
console.log str | ||
|
||
debug: (str) -> | ||
console.log '[' + pack.name.magenta, '-', 'DEBUG'.upcase().green.inverse + ']', str | ||
|
||
info: (str) -> | ||
console.log '[' + pack.name.magenta, '-', 'info'.white + ']', str | ||
|
||
warn: (str) -> | ||
console.log '[' + pack.name.magenta, '-', 'warn'.upcase().yellow + ']', str | ||
|
||
error: (str) -> | ||
console.log '[' + pack.name.magenta, '-', 'debug'.upcase().red.inverse + ']', str |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
fs = require 'fs' | ||
path = require 'path' | ||
|
||
# Singleton for the contents of package.json | ||
exports.load = -> | ||
if !@package | ||
location = path.join process.cwd(), 'package.json' | ||
try { | ||
@package = JSON.parse fs.readFileSync(location) | ||
} catch (err) { | ||
@package = 'Application' | ||
} | ||
return @package | ||
else | ||
return @package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name":"node-log", | ||
"description":"Simple logger for NodeJS", | ||
"version":"0.0.1", | ||
"homepage":"http://github.com/wearefractal/node-log", | ||
"repository":"git://github.com/wearefractal/node-log.git", | ||
"author":"Fractal <contact@wearefractal.com> (http://wearefractal.com/)", | ||
"main":"./lib/mlogger.coffee", | ||
|
||
"dependencies":{ | ||
"coffee-script":"*", | ||
"colors":"*" | ||
}, | ||
"engines":{ | ||
"node":">= 0.4.0" | ||
}, | ||
"licenses":[ | ||
{ | ||
"type":"MIT", | ||
"url":"http://github.com/wearefractal/node-log/raw/master/LICENSE" | ||
} | ||
] | ||
} |