debug-logtron
Advanced tools
Comparing version 2.1.0 to 2.1.1
'use strict'; | ||
var Writable = require('readable-stream/writable'); | ||
var globalDebuglog = require('debuglog'); | ||
var inspect = require('util/').inspect; | ||
var inspect = require('util').inspect; | ||
@@ -24,11 +23,10 @@ module.exports = DebugLogBackend; | ||
var self = this; | ||
var stream = new Writable({ | ||
objectMode: true | ||
}); | ||
stream._write = write; | ||
var stream = { | ||
write: write | ||
}; | ||
return stream; | ||
function write(logRecord, enc, cb) { | ||
function write(logRecord, cb) { | ||
var msg = logRecord.levelName + ': ' + | ||
@@ -39,4 +37,7 @@ logRecord.fields.msg + ' ~ ' + | ||
self.log(msg); | ||
cb(); | ||
if (cb) { | ||
cb(); | ||
} | ||
} | ||
}; |
'use strict'; | ||
var assert = require('assert/'); | ||
var assert = require('assert'); | ||
var process = require('process/'); | ||
var os = require('os'); | ||
var Buffer = require('buffer').Buffer; | ||
var CircularJSON = require('circular-json'); | ||
var extend = require('xtend'); | ||
@@ -48,3 +47,3 @@ | ||
var jsonStr = CircularJSON.stringify(logRecord.fields); | ||
var jsonStr = JSON.stringify(logRecord.fields); | ||
this._buffer = new Buffer(jsonStr); | ||
@@ -51,0 +50,0 @@ } |
{ | ||
"name": "debug-logtron", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "A debug logger with a logtron interface.", | ||
@@ -20,9 +20,5 @@ "keywords": [], | ||
"dependencies": { | ||
"assert": "^1.3.0", | ||
"circular-json": "^0.1.6", | ||
"debuglog": "^1.0.1", | ||
"error": "^5.0.0", | ||
"process": "^0.10.0", | ||
"readable-stream": "^1.0.33", | ||
"util": "^0.10.3", | ||
"xtend": "^4.0.0" | ||
@@ -33,3 +29,3 @@ }, | ||
"istanbul": "^0.3.5", | ||
"lint-trap": "^1.0.0", | ||
"lint-trap": "1.0.1", | ||
"opn": "^1.0.1", | ||
@@ -36,0 +32,0 @@ "pre-commit": "0.0.11", |
@@ -30,2 +30,19 @@ 'use strict'; | ||
test('can log async', function t(assert) { | ||
var logger = allocLogger(); | ||
logger.debug('oh hi', {}, onLogged); | ||
function onLogged(err) { | ||
assert.ifError(err); | ||
assert.equal(logger.lines.length, 1); | ||
var line = logger.lines[0]; | ||
assert.equal(line.namespace, 'debuglogtron'); | ||
assert.equal(line.msg, 'debug: oh hi ~ {}'); | ||
assert.end(); | ||
} | ||
}); | ||
test('logger throws with bad namespace', function t(assert) { | ||
@@ -32,0 +49,0 @@ assert.throws(function throwIt() { |
17944
4
345
- Removedassert@^1.3.0
- Removedcircular-json@^0.1.6
- Removedreadable-stream@^1.0.33
- Removedutil@^0.10.3
- Removedassert@1.5.1(transitive)
- Removedcall-bind@1.0.8(transitive)
- Removedcall-bind-apply-helpers@1.0.1(transitive)
- Removedcall-bound@1.0.3(transitive)
- Removedcircular-json@0.1.6(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removeddefine-data-property@1.1.4(transitive)
- Removeddefine-properties@1.2.1(transitive)
- Removeddunder-proto@1.0.1(transitive)
- Removedes-define-property@1.0.1(transitive)
- Removedes-errors@1.3.0(transitive)
- Removedes-object-atoms@1.1.1(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedget-intrinsic@1.2.7(transitive)
- Removedget-proto@1.0.1(transitive)
- Removedgopd@1.2.0(transitive)
- Removedhas-property-descriptors@1.0.2(transitive)
- Removedhas-symbols@1.1.0(transitive)
- Removedhasown@2.0.2(transitive)
- Removedinherits@2.0.32.0.4(transitive)
- Removedisarray@0.0.1(transitive)
- Removedmath-intrinsics@1.1.0(transitive)
- Removedobject-keys@1.1.1(transitive)
- Removedobject.assign@4.1.7(transitive)
- Removedreadable-stream@1.1.14(transitive)
- Removedset-function-length@1.2.2(transitive)
- Removedstring_decoder@0.10.31(transitive)
- Removedutil@0.10.4(transitive)
- Removedwru@0.3.0(transitive)