Logger is a duplex stream. The .pipe
functionality removes the need for most of the _name
bookkeeping in logger.js
. All Transports become transform streams (in object-mode) for an object with well known properties, similar to what common.log
expects now.
Transport
objects pipe themselves to their .format
property (if it exists) which a pipe-chain of other format Transform
streams which all expect the same object format.
var stream = require('stream');
var Transport = modules.exports = function Transport(options) {
//
// Option 1: Have an output property for each stream which the logger
// picks up on when calling `Logger.prototype.add`. The drawback to
// this is that the `Transport` itself isn't really a pipe source.
//
this.output = options.format ? this.pipe(options.format) : this;
//
// Options 2: Be a proper Transform stream
//
stream.Transform.call(this);
};
Transport.prototype._transform = function (obj) {
}
- label
- message
- meta
- showLevel
- timestamp
- raw
- stripColors
- json
- logstash
- stringify
- formatter
- filters
- colorize
- prettyPrint (with additional
depth
option) - humanReadableUnhandledException
- maxsize
- maxFiles
- datePattern
- eol
- maxRetries
- filename
- dirname
- options
- stream
- maxsize
- rotationFormat
- tailable
- eol
- maxRetries
- filename
- dirname
- options
- stream
- ssl
- host
- port
- auth
- path
- debugStdout
- alignment of levels
- string interpolation (e.g.
"%s ok", 'foo'
)
- What is the difference between something like
colorize
and something likegzip
. - How does
fileRotate
work given that it is actually a set of custom events on top of streams? - What are the exact details for the intermediate object format?
- Can we actually even implement a
Transform
stream that handles an intermediate pipe-chain?
Some notes from previous meetings:
transports (as a stream)
flush
close
logger events
logged event should be emitted by the
logging event -> individual transport completed a particular message
each of the transport
unit test log method signature that returns true
https://github.com/winstonjs/winston/blob/master/lib/winston/transports/memory.js#L82-L83
if transports are stream, transports no longer have a callback, optional one (like in write() stream).
We have to remove ‘logged’ transport events.
most of them will be writable streams
file transport: file stream wrapper that does a couple of extra thing