strongloop / node-foreman

A Node.js Version of Foreman
http://strongloop.github.io/node-foreman/
Other
1.27k stars 119 forks source link

True RAW console output #126

Closed intervalia closed 8 years ago

intervalia commented 8 years ago

I would like to have a way to get TRUE raw console output.

I want console.error, console.info, console.warn and console.log to all just become a pass through.

You are close with log where you do this:

  this.log = function log(key, proc, string) {
    var self = this;

    if(self.raw) {
      logger.log(string);
      return;
    }
...

But with info and error you add color coding like this:

  this.info = function info(key, proc, string) {
    var stamp = (new Date().toLocaleTimeString()) + " " + key;
    logger.log(proc.color(this.pad(stamp,this.padding)), colors.cyan(string));
  };

  this.error = function error(key, proc, string) {
    var stamp = (new Date().toLocaleTimeString()) + " " + key;
    logger.error(proc.color(this.pad(stamp,this.padding)), colors.red(string));
  };

It would be nice if nothing was done to the output and that everything would not get redirected to console.log. Maybe like this:

  this.info = function info(key, proc, string) {
    if(this.raw) {
      logger.info(string);
    } else {
      var stamp = (new Date().toLocaleTimeString()) + " " + key;
      logger.log(proc.color(this.pad(stamp,this.padding)), colors.cyan(string));
    }
  };

  this.error = function error(key, proc, string) {
    if(this.raw) {
      logger.error(string);
    } else {
      var stamp = (new Date().toLocaleTimeString()) + " " + key;
      logger.error(proc.color(this.pad(stamp,this.padding)), colors.red(string));
    }
  };
intervalia commented 8 years ago

This is not the issue I thought it was. The issue is really that there is not true sync mechanism between stdout and stderr. I will enter a different issue for that.