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] Middleware API for cross-environment organization and end-user extensibility #398

Closed
thebigredgeek opened this issue Dec 26, 2016 · 3 comments
Labels
discussion This issue is requesting comments and discussion feature This proposes or provides a feature or enhancement

Comments

@thebigredgeek
Copy link
Contributor

Discuss!

@thebigredgeek thebigredgeek added discussion This issue is requesting comments and discussion v3 labels Dec 26, 2016
@thebigredgeek
Copy link
Contributor Author

thebigredgeek commented Dec 26, 2016

something like this

 //Stdout would be default console.log middleware
import debug, { StdoutMiddleware } from 'debug';
const log = debug('log');
// Add some sort of new middleware element
log.use((data, next) => ... )
// replace Stdout (console.log) with console.info at same position in middleware array
log.replace(StdoutMiddleware, (data, next) => {
  console.info.apply(console, data);
  next(); 
});

// maybe create a stderr only log for failed uploads:
const appUploadLog = debug('app:upload');

const appUploadErrLog = appUploadLog
  .child('error')
  .replace(StdoutMiddleware, (data, next) => {
    console.error.apply(console, data);
    next()
  });

@thebigredgeek thebigredgeek changed the title RFC: 3.0 middleware API RFC: 3.0 middleware API for cross-environment organization and extensibility Dec 26, 2016
@thebigredgeek thebigredgeek changed the title RFC: 3.0 middleware API for cross-environment organization and extensibility RFC: 3.0 middleware API for cross-environment organization and end-user extensibility Dec 26, 2016
@Qix- Qix- removed the v3 label Jun 20, 2018
@Qix-
Copy link
Member

Qix- commented Jun 20, 2018

Why not just use EventEmitters? This module doesn't need to be super over-enterprised with middleware and the like.

@Qix- Qix- added the feature This proposes or provides a feature or enhancement label Jun 20, 2018
@Qix- Qix- changed the title RFC: 3.0 middleware API for cross-environment organization and end-user extensibility [RFC] Middleware API for cross-environment organization and end-user extensibility Jun 20, 2018
@Qix-
Copy link
Member

Qix- commented Dec 19, 2018

Maybe not with event emitters, but #556 has a newer and more relevant discussion on this.

Closing in favor of that issue.

@Qix- Qix- closed this as completed Dec 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion This issue is requesting comments and discussion feature This proposes or provides a feature or enhancement
Development

No branches or pull requests

9 participants