Comparing version 0.1.9 to 0.1.10
@@ -194,2 +194,6 @@ ##Logging. | ||
* `name` : the name of the logger logging the event. | ||
* `pid` : the process pid. | ||
* `gid` : the group id of the process. | ||
* `hostname` : the hostname. | ||
* `processTitle` : the title of the process | ||
@@ -196,0 +200,0 @@ To override the default pattern just provide it in the options. |
@@ -0,1 +1,12 @@ | ||
#0.1.10 / 2012-11-14 | ||
* Added new properites to logger events | ||
* gid | ||
* pid | ||
* processTitle | ||
* hostname | ||
#0.1.91 / 2012-10-01 | ||
* Added `_getSuper` to classes declared with comb.define | ||
#0.1.9 / 2012-09-22 | ||
@@ -2,0 +13,0 @@ * Change comb.array.intersection to not use recursion |
@@ -64,3 +64,3 @@ /** | ||
function asyncLoop(promise, cb, scope, limit) { | ||
if(isNumber(scope)){ | ||
if (isNumber(scope)) { | ||
limit = scope; | ||
@@ -79,4 +79,4 @@ scope = null; | ||
serial(list).then(function (loopResults) { | ||
ret.callback({loopResults:flatten(loopResults) || [], arr:results}); | ||
}, function(error){ | ||
ret.callback({loopResults: flatten(loopResults) || [], arr: results}); | ||
}, function (error) { | ||
error = compact(error); | ||
@@ -1103,30 +1103,30 @@ ret.errback(error.length === 1 ? error[0] : error); | ||
var asyncExports = (exports.async = { | ||
array:asyncArray, | ||
forEach:asyncForEach, | ||
map:asyncMap, | ||
filter:asyncFilter, | ||
every:asyncEvery, | ||
some:asyncSome, | ||
zip:asyncZip, | ||
sum:asyncSum, | ||
avg:asyncAvg, | ||
sort:asyncSort, | ||
min:asyncMin, | ||
max:asyncMax, | ||
difference:asyncDifference, | ||
removeDuplicates:asyncRemoveDuplicates, | ||
unique:asyncUnique, | ||
rotate:asyncRotate, | ||
permutations:asyncPermutations, | ||
transpose:asyncTranspose, | ||
valuesAt:asyncValuesAt, | ||
union:asyncUnion, | ||
intersect:asyncIntersect, | ||
powerSet:asyncPowerSet, | ||
cartesian:asyncCartesian, | ||
compact:asyncCompact, | ||
multiply:asyncMultiply, | ||
flatten:asyncFlatten, | ||
pluck:asyncPluck, | ||
invoke:asyncInvoke | ||
array: asyncArray, | ||
forEach: asyncForEach, | ||
map: asyncMap, | ||
filter: asyncFilter, | ||
every: asyncEvery, | ||
some: asyncSome, | ||
zip: asyncZip, | ||
sum: asyncSum, | ||
avg: asyncAvg, | ||
sort: asyncSort, | ||
min: asyncMin, | ||
max: asyncMax, | ||
difference: asyncDifference, | ||
removeDuplicates: asyncRemoveDuplicates, | ||
unique: asyncUnique, | ||
rotate: asyncRotate, | ||
permutations: asyncPermutations, | ||
transpose: asyncTranspose, | ||
valuesAt: asyncValuesAt, | ||
union: asyncUnion, | ||
intersect: asyncIntersect, | ||
powerSet: asyncPowerSet, | ||
cartesian: asyncCartesian, | ||
compact: asyncCompact, | ||
multiply: asyncMultiply, | ||
flatten: asyncFlatten, | ||
pluck: asyncPluck, | ||
invoke: asyncInvoke | ||
}); | ||
@@ -1201,3 +1201,3 @@ | ||
ret = merge(when(p), { | ||
promise:function () { | ||
promise: function () { | ||
return asyncArray(this) | ||
@@ -1204,0 +1204,0 @@ } |
@@ -7,3 +7,3 @@ /** | ||
var callSuper = function (args, a) { | ||
function callSuper(args, a) { | ||
var meta = this.__meta, | ||
@@ -24,6 +24,23 @@ supers = meta.supers, | ||
return null; | ||
}; | ||
} | ||
function getSuper() { | ||
var meta = this.__meta, | ||
supers = meta.supers, | ||
l = supers.length, superMeta = meta.superMeta, pos = superMeta.pos; | ||
if (l > pos) { | ||
var name = superMeta.name, f = superMeta.f, m; | ||
do { | ||
m = supers[pos][name]; | ||
if ("function" === typeof m && (m = m._f || m) !== f) { | ||
superMeta.pos = 1 + pos; | ||
return m.bind(this); | ||
} | ||
} while (l > ++pos); | ||
} | ||
return null; | ||
} | ||
var defaultFunction = function () { | ||
function defaultFunction() { | ||
var meta = this.__meta || {}, | ||
@@ -43,6 +60,7 @@ supers = meta.supers, | ||
return null; | ||
}; | ||
} | ||
; | ||
var functionWrapper = function (f, name) { | ||
function functionWrapper(f, name) { | ||
var wrapper = function () { | ||
@@ -58,3 +76,4 @@ var ret, meta = this.__meta || {}; | ||
return wrapper; | ||
}; | ||
} | ||
; | ||
@@ -65,3 +84,3 @@ | ||
*/ | ||
var defineMixinProps = function (child, proto) { | ||
function defineMixinProps(child, proto) { | ||
@@ -93,3 +112,4 @@ var operations = proto.setters || {}; | ||
} | ||
}; | ||
} | ||
; | ||
@@ -100,11 +120,11 @@ | ||
*/ | ||
var mixin = function () { | ||
function mixin() { | ||
var args = Array.prototype.slice.call(arguments), l = args.length; | ||
var child = this.prototype, childMeta = child.__meta, thisMeta = this.__meta, bases = child.__meta.bases, staticBases = bases.slice(), | ||
staticSupers = thisMeta.supers || [], supers = childMeta.supers|| []; | ||
staticSupers = thisMeta.supers || [], supers = childMeta.supers || []; | ||
for (var i = 0; i < l; i++) { | ||
var m = args[i], mProto = m.prototype; | ||
var protoMeta = mProto.__meta, meta = m.__meta; | ||
!protoMeta && (protoMeta = (mProto.__meta = {proto :mProto || {}})); | ||
!meta && (meta = (m.__meta = {proto :m.__proto__ || {}})); | ||
!protoMeta && (protoMeta = (mProto.__meta = {proto:mProto || {}})); | ||
!meta && (meta = (m.__meta = {proto:m.__proto__ || {}})); | ||
defineMixinProps(child, protoMeta.proto || {}); | ||
@@ -118,3 +138,4 @@ defineMixinProps(this, meta.proto || {}); | ||
return this; | ||
}; | ||
} | ||
; | ||
@@ -124,3 +145,3 @@ /** | ||
*/ | ||
var mixinSupers = function (sup, arr, bases) { | ||
function mixinSupers(sup, arr, bases) { | ||
var meta = sup.__meta; | ||
@@ -141,3 +162,4 @@ !meta && (meta = (sup.__meta = {})); | ||
} | ||
}; | ||
} | ||
; | ||
@@ -148,3 +170,3 @@ | ||
*/ | ||
var defineProps = function (child, proto) { | ||
function defineProps(child, proto) { | ||
var operations = proto.setters; | ||
@@ -178,5 +200,6 @@ if (operations) { | ||
}; | ||
} | ||
; | ||
var _export = function (obj, name) { | ||
function _export(obj, name) { | ||
if (obj && name) { | ||
@@ -188,3 +211,4 @@ obj[name] = this; | ||
return this; | ||
}; | ||
} | ||
; | ||
@@ -195,3 +219,3 @@ | ||
*/ | ||
var __define = function (child, sup, proto) { | ||
function __define(child, sup, proto) { | ||
var childProto = child.prototype, supers = []; | ||
@@ -248,5 +272,7 @@ var unique = "define" + ++classCounter, bases = [], staticBases = []; | ||
childProto._super = child._super = callSuper; | ||
childProto._getSuper = child._getSuper = getSuper; | ||
child.as = _export; | ||
childProto._static = child; | ||
}; | ||
} | ||
; | ||
@@ -484,8 +510,9 @@ | ||
*/ | ||
exports.define = function (sup, proto) { | ||
var child = function () { | ||
exports.define = function define(sup, proto) { | ||
function defineConstructor() { | ||
this.constructor.apply(this, arguments); | ||
}; | ||
__define(child, sup, proto); | ||
return child.init() || child; | ||
} | ||
__define(defineConstructor, sup, proto); | ||
return defineConstructor.init() || defineConstructor; | ||
}; | ||
@@ -509,5 +536,6 @@ | ||
*/ | ||
exports.singleton = function (sup, proto) { | ||
exports.singleton = function singleton(sup, proto) { | ||
var retInstance; | ||
var child = function () { | ||
function singletonConstructor() { | ||
if (!retInstance) { | ||
@@ -518,6 +546,7 @@ this.constructor.apply(this, arguments); | ||
return retInstance; | ||
}; | ||
__define(child, sup, proto); | ||
return child.init() || child; | ||
} | ||
__define(singletonConstructor, sup, proto); | ||
return singletonConstructor.init() || singletonConstructor; | ||
}; | ||
@@ -1,5 +0,6 @@ | ||
var define = require("../define.js"), | ||
var os = require("os"), | ||
define = require("../define.js"), | ||
base = require("../base"), | ||
isString = base.isString, | ||
merge = base.merge, | ||
merge = base.merge, | ||
isUndefinedOrNull = base.isUndefinedOrNull, | ||
@@ -16,5 +17,5 @@ isHash = base.isHash, | ||
var LoggerTree = define.define(null, { | ||
instance:{ | ||
instance: { | ||
constructor:function (root) { | ||
constructor: function (root) { | ||
this.__root = root; | ||
@@ -27,3 +28,3 @@ this.__name = root.name; | ||
__getSubLoggers:function () { | ||
__getSubLoggers: function () { | ||
var map = this.__map, ret = [], n; | ||
@@ -39,15 +40,15 @@ for (var i in map) { | ||
__getLoggers:function () { | ||
__getLoggers: function () { | ||
return [this.__root].concat(this.__getSubLoggers()) | ||
}, | ||
getCurrentLoggers:function () { | ||
getCurrentLoggers: function () { | ||
return this.__getLoggers(); | ||
}, | ||
getSubLoggers:function () { | ||
getSubLoggers: function () { | ||
return this.__getSubLoggers(); | ||
}, | ||
getLogger:function (name) { | ||
getLogger: function (name) { | ||
var ret; | ||
@@ -76,10 +77,10 @@ if (name) { | ||
getRootLogger:function () { | ||
getRootLogger: function () { | ||
return this.__root; | ||
}, | ||
isDisabled:function (level) { | ||
isDisabled: function (level) { | ||
}, | ||
resetConfiguration:function () { | ||
resetConfiguration: function () { | ||
}, | ||
@@ -91,3 +92,3 @@ | ||
addAppender:function (appender) { | ||
addAppender: function (appender) { | ||
var map = this.__map; | ||
@@ -99,3 +100,3 @@ for (var i in map) { | ||
removeAppender:function (name) { | ||
removeAppender: function (name) { | ||
var map = this.__map; | ||
@@ -107,4 +108,4 @@ for (var i in map) { | ||
setters:{ | ||
level:function (level) { | ||
setters: { | ||
level: function (level) { | ||
this.__level = level; | ||
@@ -122,4 +123,4 @@ if (level && level instanceof Level) { | ||
getters:{ | ||
categories:function () { | ||
getters: { | ||
categories: function () { | ||
return this.getCurrentLoggers().map(function (l) { | ||
@@ -130,3 +131,3 @@ return l.fullName; | ||
name:function () { | ||
name: function () { | ||
var ret = this.__name; | ||
@@ -142,7 +143,7 @@ if (this.__parent) { | ||
level:function () { | ||
level: function () { | ||
return this.__level; | ||
}, | ||
additive:function () { | ||
additive: function () { | ||
return this.__root.additive; | ||
@@ -159,3 +160,3 @@ } | ||
comb.logging = merge({ | ||
Level:Level | ||
Level: Level | ||
}, configurators); | ||
@@ -246,6 +247,6 @@ /** | ||
instance:{ | ||
instance: { | ||
/**@lends comb.logging.Logger.prototype*/ | ||
constructor:function (name, parent) { | ||
constructor: function (name, parent) { | ||
this.__additive = true; | ||
@@ -271,3 +272,3 @@ this.__name = name; | ||
*/ | ||
info:function (message) { | ||
info: function (message) { | ||
return this.log.apply(this, [Level.INFO].concat(argsToArray(arguments))); | ||
@@ -283,3 +284,3 @@ }, | ||
*/ | ||
debug:function (message) { | ||
debug: function (message) { | ||
return this.log.apply(this, [Level.DEBUG].concat(argsToArray(arguments))); | ||
@@ -295,3 +296,3 @@ }, | ||
*/ | ||
error:function (message) { | ||
error: function (message) { | ||
return this.log.apply(this, [Level.ERROR].concat(argsToArray(arguments))); | ||
@@ -307,3 +308,3 @@ }, | ||
*/ | ||
warn:function (message) { | ||
warn: function (message) { | ||
return this.log.apply(this, [Level.WARN].concat(argsToArray(arguments))); | ||
@@ -319,3 +320,3 @@ }, | ||
*/ | ||
trace:function (message) { | ||
trace: function (message) { | ||
return this.log.apply(this, [Level.TRACE].concat(argsToArray(arguments))); | ||
@@ -331,3 +332,3 @@ }, | ||
*/ | ||
fatal:function (message) { | ||
fatal: function (message) { | ||
return this.log.apply(this, [Level.FATAL].concat(argsToArray(arguments))); | ||
@@ -337,2 +338,23 @@ }, | ||
/** | ||
* Creates a log event to be passed to appenders | ||
* | ||
* @param {comb.logging.Level} level the level of the logging event | ||
* @param {String} message the message to be logged | ||
* @return {Object} the logging event | ||
*/ | ||
getLogEvent: function getLogEvent(level, message) { | ||
return { | ||
hostname: os.hostname(), | ||
pid: process.pid, | ||
gid: process.getgid(), | ||
processTitle: process.title, | ||
level: level, | ||
levelName: level.name, | ||
message: message, | ||
timeStamp: new Date(), | ||
name: this.fullName | ||
}; | ||
}, | ||
/** | ||
* Log a message | ||
@@ -345,3 +367,3 @@ * | ||
*/ | ||
log:function (level, message) { | ||
log: function (level, message) { | ||
var args = argsToArray(arguments, 1); | ||
@@ -363,9 +385,3 @@ level = Level.toLevel(level); | ||
var type = level.name.toLowerCase(), appenders = this.__appenders; | ||
var event = { | ||
level:level, | ||
levelName:level.name, | ||
message:message, | ||
timeStamp:new Date(), | ||
name:this.fullName | ||
}; | ||
var event = this.getLogEvent(level, message); | ||
Object.keys(appenders).forEach(function (i) { | ||
@@ -396,3 +412,3 @@ appenders[i].append(event); | ||
*/ | ||
addAppender:function (appender, opts) { | ||
addAppender: function (appender, opts) { | ||
var args = argsToArray(arguments); | ||
@@ -423,3 +439,3 @@ if (isString(appender)) { | ||
*/ | ||
addAppenders:function (appenders) { | ||
addAppenders: function (appenders) { | ||
appenders.forEach(this.addAppender.bind(this)); | ||
@@ -434,3 +450,3 @@ return this; | ||
*/ | ||
removeAppender:function (name) { | ||
removeAppender: function (name) { | ||
if (name in this.__appenders) { | ||
@@ -449,3 +465,3 @@ delete this.__appenders[name]; | ||
*/ | ||
removeAppenders:function (appenders) { | ||
removeAppenders: function (appenders) { | ||
appenders.forEach(this.removeAppender, this); | ||
@@ -460,3 +476,3 @@ return this; | ||
*/ | ||
removeAllAppenders:function () { | ||
removeAllAppenders: function () { | ||
Object.keys(this.__appenders).forEach(this.removeAppender.bind(this)); | ||
@@ -471,3 +487,3 @@ return this; | ||
*/ | ||
isAppenderAttached:function (name) { | ||
isAppenderAttached: function (name) { | ||
return (name in this.__appenders); | ||
@@ -484,3 +500,3 @@ }, | ||
*/ | ||
getAppender:function (name) { | ||
getAppender: function (name) { | ||
var ret; | ||
@@ -496,5 +512,5 @@ if (name in this.__appenders) { | ||
* */ | ||
setters:{ | ||
setters: { | ||
level:function (level) { | ||
level: function (level) { | ||
level = Level.toLevel(level); | ||
@@ -513,3 +529,3 @@ if (this.__additive) { | ||
additive:function (additive) { | ||
additive: function (additive) { | ||
this.__additive = additive; | ||
@@ -520,7 +536,7 @@ } | ||
/**@ignore*/ | ||
getters:{ | ||
getters: { | ||
/**@ignore*/ | ||
/**@ignore*/ | ||
subLoggers:function () { | ||
subLoggers: function () { | ||
return this._tree.getSubLoggers(); | ||
@@ -530,3 +546,3 @@ }, | ||
/**@ignore*/ | ||
level:function () { | ||
level: function () { | ||
return this.__level; | ||
@@ -536,7 +552,7 @@ }, | ||
/**@ignore*/ | ||
additive:function () { | ||
additive: function () { | ||
return this.__additive; | ||
}, | ||
isAll:function () { | ||
isAll: function () { | ||
return Level.ALL.isGreaterOrEqualToo(this.level); | ||
@@ -546,3 +562,3 @@ }, | ||
/**@ignore*/ | ||
isDebug:function () { | ||
isDebug: function () { | ||
return Level.DEBUG.isGreaterOrEqualToo(this.level); | ||
@@ -552,3 +568,3 @@ }, | ||
/**@ignore*/ | ||
isTrace:function () { | ||
isTrace: function () { | ||
return Level.TRACE.isGreaterOrEqualToo(this.level); | ||
@@ -558,3 +574,3 @@ }, | ||
/**@ignore*/ | ||
isInfo:function () { | ||
isInfo: function () { | ||
return Level.INFO.isGreaterOrEqualToo(this.level); | ||
@@ -564,3 +580,3 @@ }, | ||
/**@ignore*/ | ||
isWarn:function () { | ||
isWarn: function () { | ||
return Level.WARN.isGreaterOrEqualToo(this.level); | ||
@@ -570,3 +586,3 @@ }, | ||
/**@ignore*/ | ||
isError:function () { | ||
isError: function () { | ||
return Level.ERROR.isGreaterOrEqualToo(this.level); | ||
@@ -576,3 +592,3 @@ }, | ||
/**@ignore*/ | ||
isFatal:function () { | ||
isFatal: function () { | ||
return Level.FATAL.isGreaterOrEqualToo(this.level); | ||
@@ -582,3 +598,3 @@ }, | ||
/**@ignore*/ | ||
isOff:function () { | ||
isOff: function () { | ||
return Level.OFF.equals(this.level); | ||
@@ -588,3 +604,3 @@ }, | ||
/**@ignore*/ | ||
name:function () { | ||
name: function () { | ||
return this.__name; | ||
@@ -594,3 +610,3 @@ }, | ||
/**@ignore*/ | ||
tree:function () { | ||
tree: function () { | ||
return this._tree; | ||
@@ -600,3 +616,3 @@ }, | ||
/**@ignore*/ | ||
appenders:function () { | ||
appenders: function () { | ||
var ret = []; | ||
@@ -609,3 +625,3 @@ for (var i in this.__appenders) { | ||
categories:function () { | ||
categories: function () { | ||
return this._tree.categories; | ||
@@ -616,3 +632,3 @@ } | ||
static:{ | ||
static: { | ||
/**@lends comb.logging.Logger*/ | ||
@@ -623,3 +639,3 @@ | ||
*/ | ||
getRootLogger:function () { | ||
getRootLogger: function () { | ||
return rootTree.getRootLogger(); | ||
@@ -633,3 +649,3 @@ }, | ||
*/ | ||
getLogger:function (name) { | ||
getLogger: function (name) { | ||
return rootTree.getLogger(name); | ||
@@ -636,0 +652,0 @@ } |
{ | ||
"name":"comb", | ||
"description":"A framework for node", | ||
"version":"0.1.9", | ||
"version":"0.1.10", | ||
"keywords":["OO", "Object Oriented", "Collections", "Tree", "HashTable", "Pool", "Logging", "Promise", "Promises", "Proxy"], | ||
@@ -6,0 +6,0 @@ "repository":{ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1639404
11336