Permalink
Browse files

[test] first working test version

  • Loading branch information...
1 parent d9fe2d7 commit 3e439e3769c224e2edd88925324b622290603035 @dscape committed Dec 13, 2012
Showing with 226 additions and 870 deletions.
  1. +10 −8 lib/winston-statsd.js
  2. +5 −1 package.json
  3. +156 −815 tests/fixtures/master.json
  4. +50 −41 tests/macros.js
  5. +5 −5 tests/master-tests.js
View
@@ -34,16 +34,18 @@ var Statsd = exports.Statsd = function (options) {
//
// hostname is required
//
- if (typeof options.hostname !== 'string') {
- throw new Error('hostname is a required option to use winston-statsd');
- }
+ options.hostname = typeof options.hostname !== 'string'
+ ? 'localhost'
+ : options.hostname
+ ;
//
// port is required
//
- if (typeof options.port !== number) {
- throw new Error('port is a required option to use winston-statsd');
- }
+ options.port = typeof options.port !== 'number'
+ ? 8125
+ : options.port
+ ;
//
// choose separator to be used, e.g. if `:`
@@ -74,7 +76,7 @@ var Statsd = exports.Statsd = function (options) {
//
// creates a new client connection to `statsd`
//
- this.client = new lynx('localhost', 8125, options);
+ this.client = new lynx(options.hostname, options.port, options);
//
// we are now ready to go
@@ -243,6 +245,6 @@ Statsd.prototype.log = function (level, msg, meta, callback) {
else {
this.client.send(metrics);
}
-
+
this.emit('logged');
};
View
@@ -20,6 +20,10 @@
"author": "nuno job <nunojobpinto@gmail.com> (http://nunojob.com)",
"license": "mit",
"dependencies": {
- "lynx": "0.0.11"
+ "lynx": "~0.0.11",
+ "winston": "~0.6.2"
+ },
+ "devDependecies": {
+ "tap": "~0.3.3"
}
}
Oops, something went wrong.

0 comments on commit 3e439e3

Please sign in to comment.