Comparing version 0.1.1 to 0.2.0
@@ -14,2 +14,9 @@ var dgram = require('dgram') | ||
function makeError(opts) { | ||
var error = new Error(opts.message); | ||
error.f = opts.f; | ||
error.args = opts.args; | ||
return error; | ||
} | ||
// | ||
@@ -40,2 +47,6 @@ // Max idle time for a ephemeral socket | ||
function Lynx(host, port, options) { | ||
if (!(this instanceof Lynx)) { | ||
return new Lynx(host, port, options); | ||
} | ||
var self = this; | ||
@@ -140,4 +151,10 @@ | ||
, stopped = false | ||
, duration | ||
, start_hrtime | ||
; | ||
if (typeof process.hrtime === "function") { | ||
var start_hrtime = process.hrtime(); | ||
} | ||
// | ||
@@ -155,5 +172,5 @@ // ### function stop() | ||
self.on_error( | ||
{ message : "Can't stop a timer twice" | ||
makeError({ message : "Can't stop a timer twice" | ||
, f : 'stop' | ||
}); | ||
})); | ||
return; | ||
@@ -165,3 +182,11 @@ } | ||
// | ||
var duration = new Date ().getTime() - start_time; | ||
if (start_hrtime) { | ||
var stop_hrtime = process.hrtime() | ||
, seconds = stop_hrtime[0] - start_hrtime[0] | ||
, nanos = stop_hrtime[1] - start_hrtime[1] | ||
; | ||
duration = seconds * 1000 + nanos / 1000000 | ||
} else { | ||
duration = new Date ().getTime() - start_time; | ||
} | ||
@@ -257,6 +282,6 @@ // | ||
this.on_error( | ||
{ message : "Can't set if its not even an array by now" | ||
makeError({ message : "Can't set if its not even an array by now" | ||
, f : 'count' | ||
, args : arguments | ||
}); | ||
})); | ||
return; | ||
@@ -273,6 +298,6 @@ } | ||
this.on_error( | ||
{ message : 'Must be either a number or a string' | ||
makeError({ message : 'Must be either a number or a string' | ||
, f : 'count' | ||
, args : arguments | ||
}); | ||
})); | ||
return; | ||
@@ -385,6 +410,6 @@ } | ||
this.on_error( | ||
{ message : 'Nothing to send' | ||
makeError({ message : 'Nothing to send' | ||
, f : 'send' | ||
, args : arguments | ||
}); | ||
})); | ||
return; | ||
@@ -640,3 +665,3 @@ } | ||
Lynx.prototype._default_error_handler = function _default_error_handler(e) { | ||
console.log(e.message); | ||
this.emit('error', e); | ||
}; | ||
@@ -643,0 +668,0 @@ |
{ | ||
"name": "lynx", | ||
"description": "Minimalistic StatsD client for Node.js programs", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"author": "Lloyd Hilaiel", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
# lynx | ||
![NPM Downloads](http://img.shields.io/npm/dm/lynx.svg?style=flat) ![NPM Version](http://img.shields.io/npm/v/lynx.svg?style=flat) | ||
A minimalistic node.js client for [statsd] server. Fork of original work by [sivy] | ||
@@ -4,0 +6,0 @@ |
@@ -59,4 +59,7 @@ var macros = require('./macros'); | ||
// | ||
connection.on('error', function (err) { | ||
}); | ||
second_timer.stop(); | ||
}, 150); | ||
}); |
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
43033
1251
175