Permalink
Browse files

first commit, works, havent tested on older browsers

  • Loading branch information...
0 parents commit bc3b057cee07f0b59ef849b5cbb4696998dacbcd @lancejpollard committed Oct 22, 2011
Showing with 481 additions and 0 deletions.
  1. +31 −0 .gitignore
  2. +34 −0 README.md
  3. +186 −0 lib/common-logger.js
  4. +29 −0 package.json
  5. +48 −0 spec/common_logger_spec.coffee
  6. +153 −0 src/common-logger.coffee
@@ -0,0 +1,31 @@
+## MAC OS
+.DS_Store
+*.gem
+## TEXTMATE
+*.tmproj
+tmtags
+
+## EMACS
+*~
+\#*
+.\#*
+
+## VIM
+*.swp
+
+## PROJECT::GENERAL
+coverage
+rdoc
+pkg
+
+## PROJECT::SPECIFIC
+
+doc
+doc/*
+doc/**/*
+
+node_modules
+node_modules/*
+node_modules/**/*
+
+spec/secrets.coffee
@@ -0,0 +1,34 @@
+# CommonLogger
+
+> Cross-browser and Node.js empowered logging.
+
+## Install
+
+```
+npm install common-logger
+```
+
+## Api
+
+``` coffeescript
+logger = new CommonLogger
+logger.colors[CommonLogger.WARN] = CommonLogger.ANSI.RED
+logger.info
+logger.bench 1000 -> 1 + 1
+logger.on "frame", (fps) ->
+ $("#log-line-template").tmpl(fps).appendTo("#log-panel")
+
+logger.on "message", (data) ->
+ $("#log-line-template").tmpl(data).appendTo("#log-panel")
+```
+
+## Resources
+
+- http://en.wikipedia.org/wiki/Common_Log_Format
+
+## Development
+
+```
+./node_modules/coffee-script/bin/coffee -o lib -w src
+./node_modules/jasmine-node/bin/jasmine-node --coffee ./spec
+```

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -0,0 +1,29 @@
+{
+ "name": "common-logger",
+ "version": "0.2.0",
+ "description": "Cross-browser and Node.js empowered logging",
+ "homepage": "http://github.com/viatropos/common-logger.js",
+ "main": "lib/common-logger.js",
+ "author": "Lance Pollard <lancejpollard@gmail.com>",
+ "keywords": [
+ "logging",
+ "node",
+ "browser"
+ ],
+ "licenses": [
+ {
+ "type": "MIT",
+ "url": "http://mths.be/mit"
+ }
+ ],
+ "bugs": {
+ "url": "https://github.com/viatropos/common-logger.js/issues"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/viatropos/common-logger.js.git"
+ },
+ "directories": {
+ "test": "spec"
+ }
+}
@@ -0,0 +1,48 @@
+CommonLogger = require('../lib/common-logger')
+
+describe 'common-logger', ->
+ describe 'levels', ->
+ beforeEach ->
+ @logger = new CommonLogger
+
+ it "should default to debug", ->
+ expect(@logger.level).toEqual CommonLogger.DEBUG
+
+ it "should accept a new log level", ->
+ @logger.level = CommonLogger.ERROR
+ expect(@logger.level).toEqual CommonLogger.ERROR
+
+ describe 'color', ->
+ beforeEach ->
+ @logger = new CommonLogger
+
+ it "should have default colors", ->
+ expect(@logger.colors[CommonLogger.TRACE]).toEqual CommonLogger.ANSI.BLUE
+ expect(@logger.colors[CommonLogger.DEBUG]).toEqual CommonLogger.ANSI.CYAN
+
+ describe 'format', ->
+ beforeEach ->
+ @logger = new CommonLogger(colorized: false)
+
+ it 'should default to a date format', ->
+ now = new Date().toUTCString()
+ expect(@logger.info('format')).toEqual "[#{now}] INFO format"
+
+ describe 'file', ->
+
+ describe 'stream', ->
+
+ describe 'grouping', ->
+
+ describe 'benchmarking', ->
+
+ describe 'fps', ->
+ beforeEach ->
+ @logger = new CommonLogger(colorized: false)
+
+ it "should clock it!", ->
+ @logger.on "frame", ->
+ expect(@fps).toEqual 60
+ @stop()
+
+ describe 'cross-browser', ->
Oops, something went wrong.

0 comments on commit bc3b057

Please sign in to comment.