benbria / bunyan-debug-stream

A stream for bunyan that writes log entries as human readable output.
MIT License
30 stars 9 forks source link

Colored output doesn't work #3

Closed DenisIzmaylov closed 9 years ago

DenisIzmaylov commented 9 years ago

Somebody else have the same issues?

jwalton commented 9 years ago

I use the colored output literally every day. Do you have a gist or a small project that reproduces your problem?

DenisIzmaylov commented 9 years ago

I will try to demonstrate code parts:

import DebugStream from 'bunyan-debug-stream';
// ..
const logger = bunyan.createLogger({
  name: 'my-app',
  streams: [{
    stream: new DebugStream({
      basepath: __dirname,
      prefixers: {
        'module': (module, options) => {
          return {
            value: module + (options.entry['method'] ? ' => ' + options.entry['method'] : ''),
            consumed: ['module', 'method']
          };
        }
      }
    }),
    level: 'trace',
    type: 'raw'
  }]
});
kingcody commented 9 years ago

@DenisIzmaylov I was having a very similar issue, my problem was that process.stdout was not a tty and colors.js disables colored output on non-tty by default. If you think this might relate to your issue, check out #5 for my solution.

Full disclosure: I was/am using grunt with grunt-express-server to launch the application.

jwalton commented 9 years ago

@DenisIzmaylov try upgrading to v1.0.7 and adding the forceColor option. If this doesn't fix it for you, please feel free to re-open this.

DenisIzmaylov commented 9 years ago

Thank you