Browse files

v0.0.7

  • Loading branch information...
1 parent 05715c7 commit 221f25ca8aaa521d4de0d2127afb8c6eda1729d2 Douglas Martin committed Feb 4, 2012
Showing with 159 additions and 318 deletions.
  1. +14 −0 History.md
  2. +1 −1 LICENSE
  3. +0 −98 benchmark/define.benchmark.js
  4. +0 −77 benchmark/plugins/Broadcaster.benchmark.js
  5. +142 −141 lib/logging/level.js
  6. +2 −1 package.json
View
14 History.md
@@ -1,3 +1,17 @@
+0.0.7 / 2012-02-04
+==================
+ * Bug Fixes
+ * Fixed issue with array.zip
+ * Fixed error with date.parse and alternate characters
+ * Fixed MaxCallStack exceeded error
+ * Changed callback and errback to resolved listeners in a new stack using process.nextTick
+ * Changed the middle ware plugin to use process.nextTick when calling next.
+ * Altered logging.Level to allow the setting of levels from external APIs
+ * Fixed issue with runner.js where paths that contained spaces would not run
+ * Changed comb.when to test if the arguments are "promiseLike" so multiple versions of comb will work together
+ * Updated docs.
+
+
0.0.6 / 2011-12-29
==================
* Bug Fixes
View
2 LICENSE
@@ -1,6 +1,6 @@
The MIT License
-Copyright (c) 2011 Pollenware
+Copyright (c) 2011-2012 Pollenware
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
View
98 benchmark/define.benchmark.js
@@ -1,98 +0,0 @@
-require.paths.unshift('../lib')
-
-var sys = require('sys'),
- define = require('index').define,
- times = 500000
-
-function bm(label, fn) {
- var start = +new Date
- fn()
- sys.puts(' ' + label + ' : ' + (+new Date - start) + ' ms')
-}
-
-sys.puts('\n running ' + times + ' times\n')
-
-bm('prototype', function(){
- var n = times
- while (n--) {
- function User(name) {
- this.name = name.trim()
- }
- function Admin(name) {
- User.call(this, name)
- }
- new Admin('tj')
- }
-})
-
-bm('sys.inherits()', function(){
- var n = times
- while (n--) {
- function User(name) {
- this.name = name.trim()
- }
- function Admin(name) {
- User.call(this, name)
- }
- sys.inherits(Admin, User)
- new Admin('tj')
- }
-})
-
-bm('class.js', function(){
- var n = times
- while (n--) {
- var User = define(null, {
- instance : {
- constructor: function(name){
- this.name = name.trim()
- }
- }
- })
- var Admin = define(User);
- new Admin('tj')
- }
-})
-
-// --- Instance Creation
-
-sys.puts('\n instance creation \n')
-
-bm('prototype instance', function(){
- var n = times
- function User(name) {
- this.name = name.trim()
- }
- function Admin(name) {
- User.call(this, name)
- }
- while (n--) new Admin('tj')
-})
-
-bm('sys.inherits() instance', function(){
- var n = times
- function User(name) {
- this.name = name.trim()
- }
- function Admin(name) {
- User.call(this, name)
- }
- sys.inherits(Admin, User)
-
- while (n--) new Admin('tj')
-})
-
-bm('class.js instance', function(){
- var n = times
- var User = define(null, {
- instance : {
- constructor: function(name){
- this.name = name.trim()
- }
- }});
- var Admin = define(User);
- while (n--) new Admin('tj')
-})
-
-sys.puts('')
-
View
77 benchmark/plugins/Broadcaster.benchmark.js
@@ -1,77 +0,0 @@
-var comb = require("../../lib");
- Broadcaster = comb.plugins.Broadcaster,
- util = require('util'),
- EventEmitter = require('events').EventEmitter;
-
-var CombBroadCaster = comb.define(Broadcaster, {
- instance : {
- test : function(){
- this.broadcast("test", "hello");
- }
- }
- });
-
-var NodeEventEmitter = function(){
- EventEmitter.call(this);
-};
-util.inherits(NodeEventEmitter, EventEmitter);
-NodeEventEmitter.prototype.test = function(){
- this.emit("test", "hello");
-};
-
-var printStats = function(name, op, start, end) {
- console.log(name + " " + op + " TIME = %dms", (+end) - (+start));
-};
-
-var count = 10000000;
-var testBroadcasts = function() {
- console.log("\nTESTING BROADCASTS %d TIMES....", count);
- var start = new Date();
- var nodeEmitter = new NodeEventEmitter();
- for (var i = 0; i < count; i++) {
- nodeEmitter.test();
- }
- var end = new Date();
- printStats("NODE", "BROADCASTS", start, end);
- start = new Date();
- var combBroadcaster = new CombBroadCaster();
- for (var i = 0; i < count; i++) {
- combBroadcaster.test();
- }
- end = new Date();
- printStats("COMB", "BROADCASTS", start, end);
-};
-
-var testListens = function(){
- console.log("\nTESTING LISTEN/UNLISTEN %d TIMES", count);
- var han;
- var start = new Date();
- var nodeEmitter = new NodeEventEmitter();
- nodeEmitter.setMaxListeners(count);
- for (var i = 0; i < count; i++) {
- var han = function(){};
- nodeEmitter.on("test", han);
- nodeEmitter.test();
- nodeEmitter.removeListener("test", han);
- }
- var end = new Date();
- printStats("NODE", "BROADLISTEN/UNLISTENCASTS", start, end);
- start = new Date();
- var combBroadcaster = new CombBroadCaster();
- for (var i = 0; i < count; i++) {
- var han = combBroadcaster.listen("test", function(){});
- combBroadcaster.test();
- combBroadcaster.unListen(han);
- }
- end = new Date();
- printStats("COMB", "LISTEN/UNLISTEN", start, end);
-};
-
-var test = function() {
- console.log("STARTING TEST....");
- testBroadcasts();
- testListens();
-};
-
-test();
-
View
283 lib/logging/level.js
@@ -1,25 +1,25 @@
var define = require("../define.js").define, base = require("../base");
var LEVELS = {
- ALL : -100000,
- DEBUG : 1,
- TRACE : 2,
- INFO : 3,
- WARN :4,
- ERROR : 5,
- FATAL:6,
- OFF : 100000
+ ALL:-100000,
+ DEBUG:1,
+ TRACE:2,
+ INFO:3,
+ WARN:4,
+ ERROR:5,
+ FATAL:6,
+ OFF:100000
};
var LEVELS_REVERSE = {
- "-100000" : "ALL",
- "1" : "DEBUG",
- "2" : "TRACE",
- "3" : "INFO",
- "4": "WARN",
- "5" : "ERROR",
- "6" : "FATAL",
- "100000" : "OFF"
+ "-100000":"ALL",
+ "1":"DEBUG",
+ "2":"TRACE",
+ "3":"INFO",
+ "4":"WARN",
+ "5":"ERROR",
+ "6":"FATAL",
+ "100000":"OFF"
};
/**
@@ -49,138 +49,139 @@ var LEVELS_REVERSE = {
* @property {String} name the name of level.
*/
var Level = (exports = module.exports = define(null, {
- instance : {
- /**@lends comb.logging.Level.prototype*/
+ instance:{
+ /**@lends comb.logging.Level.prototype*/
- constructor : function(level, name) {
- this.level = level;
- this.name = name;
- },
+ constructor:function (level, name) {
+ this.level = level;
+ this.name = name;
+ },
- /**
- * Determing if this level is >= another level
- * @param {comb.logging.Level} level the level to test against
- *
- * @returns {Boolean} true if this is >= false otherwise.
- */
- isGreaterOrEqualToo : function(level) {
- var ret = false;
- if (level && level instanceof Level) {
- if (this.level >= level.level) {
- ret = true;
- }
- }
- return ret;
- },
+ /**
+ * Determing if this level is >= another level
+ * @param {comb.logging.Level} level the level to test against
+ *
+ * @returns {Boolean} true if this is >= false otherwise.
+ */
+ isGreaterOrEqualToo:function (level) {
+ var ret = false;
+ if (level && base.isNumber(level.level)) {
+ if (this.level >= level.level) {
+ ret = true;
+ }
+ }
+ return ret;
+ },
- /**
- * Determing if this level is equal to another level based off of the numerical rank.
- *
- * @param {comb.logging.Level} level the level to compare
- *
- * @returns {Boolean} true if this is equal to that false otherwise.
- */
- equals : function(level) {
- return level.level == this.level;
- }
- },
- static : {
- /**@lends comb.logging.Level*/
+ /**
+ * Determing if this level is equal to another level based off of the numerical rank.
+ *
+ * @param {comb.logging.Level} level the level to compare
+ *
+ * @returns {Boolean} true if this is equal to that false otherwise.
+ */
+ equals:function (level) {
+ return level.level == this.level;
+ }
+ },
+ static:{
+ /**@lends comb.logging.Level*/
- /**
- * Converts a numerical or string representation of a level, if a default level is provided,
- * then if a level cannot be determined then the default level is used.
- *
- * @param {Number|String|comb.logging.Level} level the level to try to convert
- * @param {comb.logging.Level} [defaultLevel] default level to use if one cannot be determined,
- *
- * @returns {comb.logging.Level|null} returns a level if one can be determined null otherwise.
- */
- toLevel : function(level, defaultLevel) {
- var ret = null;
- var args = base.argsToArray(arguments);
- if (args.length === 1) {
- var level = args[0];
- if (level instanceof Level) {
- ret = level;
- } else if (base.isNumber(level)) {
- var strLevel = LEVELS_REVERSE[level];
- ret = Level[strLevel];
- } else if (base.isString(level)) {
- ret = Level[level.toUpperCase()];
- }
- } else {
- ret = (Level.toLevel(args[0]) || args[1]);
- }
- return ret;
- },
+ /**
+ * Converts a numerical or string representation of a level, if a default level is provided,
+ * then if a level cannot be determined then the default level is used.
+ *
+ * @param {Number|String|comb.logging.Level} level the level to try to convert
+ * @param {comb.logging.Level} [defaultLevel] default level to use if one cannot be determined,
+ *
+ * @returns {comb.logging.Level|null} returns a level if one can be determined null otherwise.
+ */
+ toLevel:function (level, defaultLevel) {
+ var ret = null;
+ var args = base.argsToArray(arguments);
+ if (args.length === 1) {
+ var level = args[0];
- /**
- * Adds a new level to the Level object.
- *
- * @example
- *
- * logger = Logger.getLogger("my.logger");
- *
- * //create the custom level
- * Level.addLevel("custom_Level", 20);
- *
- * //now set the level on a logger
- * logger.level = Level.CUSTOM_LEVEL;
- *
- * @param {string} label the label of the level, <b>Note:</b> the label will be coverted to uppercase.
- * @param {number} level the level of the level
- *
- * @return {undefined|comb.logging.Level} the level that was created.
- *
- */
- addLevel : function(label, level){
- var ret;
- if(base.isString(label) && base.isNumber(level)){
- label = label.toUpperCase();
- LEVELS_REVERSE[level] = label;
- LEVELS[label] = level;
- ret = (this[label] = new Level(level, label));
- }
- return ret;
- },
+ if (base.isNumber(level)) {
+ var strLevel = LEVELS_REVERSE[level];
+ ret = Level[strLevel];
+ } else if (base.isString(level)) {
+ ret = Level[level.toUpperCase()];
+ } else {
+ ret = level;
+ }
+ } else {
+ ret = (Level.toLevel(args[0]) || args[1]);
+ }
+ return ret;
+ },
- /**
- * Level to allow logging of all events.
- */
- ALL : null,
- /**
- * Logs only events debug or greater.
- */
- DEBUG : null,
- /**
- * Like debug but provides a finer level of detail
- */
- TRACE : null,
- /**
- * Only info, or error related events
- */
- INFO : null,
- /**
- * Only warn or error related events
- */
- WARN : null,
- /**
- * Error or fatal events
- */
- ERROR : null,
- /**
- * Only fatal events
- */
- FATAL : null,
- /**
- * No events will be logged.
- */
- OFF : null
+ /**
+ * Adds a new level to the Level object.
+ *
+ * @example
+ *
+ * logger = Logger.getLogger("my.logger");
+ *
+ * //create the custom level
+ * Level.addLevel("custom_Level", 20);
+ *
+ * //now set the level on a logger
+ * logger.level = Level.CUSTOM_LEVEL;
+ *
+ * @param {string} label the label of the level, <b>Note:</b> the label will be coverted to uppercase.
+ * @param {number} level the level of the level
+ *
+ * @return {undefined|comb.logging.Level} the level that was created.
+ *
+ */
+ addLevel:function (label, level) {
+ var ret;
+ if (base.isString(label) && base.isNumber(level)) {
+ label = label.toUpperCase();
+ LEVELS_REVERSE[level] = label;
+ LEVELS[label] = level;
+ ret = (this[label] = new Level(level, label));
+ }
+ return ret;
+ },
- }
- }));
+ /**
+ * Level to allow logging of all events.
+ */
+ ALL:null,
+ /**
+ * Logs only events debug or greater.
+ */
+ DEBUG:null,
+ /**
+ * Like debug but provides a finer level of detail
+ */
+ TRACE:null,
+ /**
+ * Only info, or error related events
+ */
+ INFO:null,
+ /**
+ * Only warn or error related events
+ */
+ WARN:null,
+ /**
+ * Error or fatal events
+ */
+ ERROR:null,
+ /**
+ * Only fatal events
+ */
+ FATAL:null,
+ /**
+ * No events will be logged.
+ */
+ OFF:null
+
+ }
+}));
for (var i in LEVELS_REVERSE) {
- Level[LEVELS_REVERSE[i]] = new Level(parseInt(i, 10), LEVELS_REVERSE[i]);
+ Level[LEVELS_REVERSE[i]] = new Level(parseInt(i, 10), LEVELS_REVERSE[i]);
}
View
3 package.json
@@ -1,7 +1,7 @@
{
"name": "comb",
"description": "A framework for node",
- "version": "0.0.6",
+ "version": "0.0.7",
"keywords" : ["OO", "Object Oriented", "Collections", "Tree", "HashTable", "Pool", "Logging", "Promise", "Promises", "Proxy"],
"repository": {
"type": "git",
@@ -10,6 +10,7 @@
"dependencies" : {
"node-proxy" : ">=0.5.2"
},
+ "homepage": "http://pollenware.github.com/comb/symbols/comb.html",
"author": "Pollenware (http://pollenware.github.com)",
"main": "index.js",
"directories": {

0 comments on commit 221f25c

Please sign in to comment.