Permalink
Browse files

first commit 0.0.1

  • Loading branch information...
0 parents commit 5f9b8de476f49cec98b193881b2dac7d72f0d05f @contra contra committed Sep 17, 2011
Showing with 129 additions and 0 deletions.
  1. +3 −0 .gitignore
  2. +1 −0 .npmignore
  3. +20 −0 LICENSE
  4. +49 −0 README.md
  5. +18 −0 lib/logger.coffee
  6. +15 −0 lib/package.coffee
  7. +23 −0 package.json
3 .gitignore
@@ -0,0 +1,3 @@
+.DS_Store
+*.log
+node_modules
1 .npmignore
@@ -0,0 +1 @@
+*.log
20 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 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 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 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 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.