Skip to content

Commit

Permalink
first commit 0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Contra committed Sep 17, 2011
0 parents commit 5f9b8de
Show file tree
Hide file tree
Showing 7 changed files with 129 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
@@ -0,0 +1,3 @@
.DS_Store
*.log
node_modules
1 change: 1 addition & 0 deletions .npmignore
@@ -0,0 +1 @@
*.log
20 changes: 20 additions & 0 deletions LICENSE
@@ -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.
49 changes: 49 additions & 0 deletions README.md
@@ -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.
18 changes: 18 additions & 0 deletions lib/logger.coffee
@@ -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
15 changes: 15 additions & 0 deletions lib/package.coffee
@@ -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
23 changes: 23 additions & 0 deletions package.json
@@ -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"
}
]
}

0 comments on commit 5f9b8de

Please sign in to comment.