winston-syslog
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -9,5 +9,7 @@ /* | ||
var glossy = require('glossy'), | ||
dgram = require('dgram'), | ||
net = require('net'); | ||
var dgram = require('dgram'), | ||
net = require('net'), | ||
util = require('util'), | ||
glossy = require('glossy'), | ||
winston = require('winston'); | ||
@@ -73,2 +75,7 @@ var levels = Object.keys({ | ||
// | ||
// Inherit from `winston.Transport`. | ||
// | ||
util.inherits(Syslog, winston.Transport); | ||
// | ||
// ### function log (level, msg, [meta], callback) | ||
@@ -84,3 +91,3 @@ // #### @level {string} Target level to log to | ||
var self = this, | ||
data = meta ? clone(meta) : {}, | ||
data = meta ? winston.clone(meta) : {}, | ||
syslogMsg, | ||
@@ -117,2 +124,3 @@ buffer; | ||
if (logErr) { self.queue.push(syslogMsg) } | ||
self.emit('logged'); | ||
} | ||
@@ -190,2 +198,3 @@ | ||
self.emit('logged'); | ||
self.queue = []; | ||
@@ -223,16 +232,2 @@ self.retries = 0; | ||
: this.socket.connect(this.port, this.host); | ||
}; | ||
// | ||
// ### function clone (obj) | ||
// #### @obj {Object} Object to clone | ||
// Deep clones the specified object (although relatively naively). | ||
// | ||
function clone (obj) { | ||
var copy = {}; | ||
for (var i in obj) { | ||
copy[i] = obj[i] instanceof Object ? clone(obj[i]) : obj[i]; | ||
} | ||
return copy; | ||
}; |
{ | ||
"name": "winston-syslog", | ||
"description": "A syslog transport for winston", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"author": "Charlie Robbins <charlie.robbins@gmail.com>", | ||
@@ -18,7 +18,8 @@ "contributors": [ | ||
"devDependencies": { | ||
"winston": "0.4.x", | ||
"vows": "0.5.x" | ||
}, | ||
"main": "./lib/winston-syslog", | ||
"scripts": { "test": "npm install winston && sudo vows test/*-test.js --spec" }, | ||
"scripts": { "test": "sudo vows test/*-test.js --spec" }, | ||
"engines": { "node": ">= 0.4.0" } | ||
} |
@@ -12,29 +12,6 @@ /* | ||
assert = require('assert'), | ||
winston = require('winston'), | ||
helpers = require('winston/test/helpers'), | ||
Syslog = require('../lib/winston-syslog').Syslog; | ||
try { | ||
var winston = require('winston'), | ||
utils = require('winston/lib/winston/utils'), | ||
helpers = require('winston/test/helpers'); | ||
} | ||
catch (ex) { | ||
var error = [ | ||
'Error running tests: ' + ex.message, | ||
'', | ||
'To run `winston-syslog` tests you need to', | ||
'install winston locally in this project', | ||
'', | ||
' $ cd ' + path.join(__dirname, '..'), | ||
' $ npm install winston', | ||
' $ vows --spec', | ||
'', | ||
'or', | ||
'', | ||
' $ npm test' | ||
].join('\n'); | ||
console.log(error); | ||
process.exit(1); | ||
} | ||
function assertSyslog (transport) { | ||
@@ -41,0 +18,0 @@ assert.instanceOf(transport, Syslog); |
10813
2
231