Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: an objectMode stream implementation for winston Transports #2

Merged
merged 15 commits into from
Apr 11, 2017

Conversation

indexzero
Copy link
Member

@indexzero indexzero commented Mar 19, 2017

The winston@3 efforts have definitely crossed the 80% mark. This PR represents the final semantics for winston-transport base implementations:

  • TransportStream: the new objectMode Writable stream which should be the base for all future Transports after winston >= 3.
  • LegacyTransportStream: the backwards compatible wrap to Transports written for winston < 3. There isn't all that much different for those implementors except that log(level, message, meta, callback) is now log(info, callback) where info is the object being plumbed along the objectMode pipe-chain. This was absolutely critical to not "break the ecosystem" and give the over 500 Transport package authors an upgrade path.

Discuss

There are currently three outstanding items that warrant discussion:

Practical implications of implementing ._writev:

The current approach will be to make an optional .logv that TransportStream implementors can take advantage of if they wish. If .logv does not exist then ._writev will call .log multiple times.

Formats for TransportStream instances: winston@3

Moves all of the log formatting into user-land and performs some plumbing in .format where it reads from the underlying _format and ._transform where it writes to the _format. We need to do this same bookkeeping in TransportStream since there are obvious Transport-specific formatting choices (e.g. to colorize console output, but not file output).

Pipe from multiple parent Logger instances:

This will work no problem today, unless the parent Logger instances are configured with different levels. While this is technically possible from winston.Container code paths, it is an unknown if the user-base is utilizing it. If you share Transports across multiple Loggers WITH DIFFERENT LEVELS please chime in here. Your input is necessary as we are strongly considering dropping this feature.

Items for merge

  • 100% code coverage for TransportStream
  • 100% code coverage for LegacyTransportStream
  • Implementation of _writev for TransportStream
  • Implementation of _writev for LegacyTransportStream
  • (Moved to a future PR) Implementation of format on TransportStream

@indexzero indexzero merged commit 0aed63a into master Apr 11, 2017
@indexzero indexzero deleted the 3.x branch April 11, 2017 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant