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

Question: How does it handle output? #8

Open
purefan opened this issue May 2, 2018 · 3 comments
Open

Question: How does it handle output? #8

purefan opened this issue May 2, 2018 · 3 comments

Comments

@purefan
Copy link

purefan commented May 2, 2018

Hi!

One of the things I need to do is run webpack and watch for file changes, another I need to do is fire up dynamodb local, another one is to keep an electron app running... all of these spit out debugging information that I may need.

Ideally, I would use your plugin and combine all their output in one single stdout that I can prefix with an identifier:

[electron] debug from the app...
[webpack] reloaded stuff
[dynamodb] requested record X

is this something I can do with your plugin? (and if so, how?)

Thanks for your hard work!

@juanfran
Copy link
Owner

juanfran commented May 5, 2018

Hi!, sorry but currently you can't do it but maybe is possible to add the feature. I'm going to try these days to see if it's possible.

@purefan
Copy link
Author

purefan commented May 7, 2018

Thanks @juanfran ! and again, thanks for all your work

@juanfran
Copy link
Owner

Hi! I haven't got an easy & clean solution to do this (yet¿), but I have an idea without changing this plugin.

function hook_stdout(message) {
  var old_write = process.stdout.write

  process.stdout.write = (function(write) {
      return function(string, encoding, fd) {
          arguments[0] = message + ': ' + arguments[0];
          write.apply(process.stdout, arguments);
      }
  })(process.stdout.write)

  return function() {
      process.stdout.write = old_write
  }
}

gulp.task('task1', function(cb) {
  hook_stdout('task example');
  
 // example gulp task
});

with this anything inside the task1 will log this "task example: example text from webpack plugin", this is what you need?

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

No branches or pull requests

2 participants