benbria / bunyan-debug-stream

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

Enable colors for non-tty stdout #5

Closed kingcody closed 9 years ago

kingcody commented 9 years ago

see Marak/colors.js#102

jwalton commented 9 years ago

Hrm... No color for TTY output is desirable in most cases, though; if you're piping your logs to a file, you probably don't want color in there. It would be nice if we could leave colors off for non-tty output by default, but turn it on if someone passed in an appropriate option (say, forceColor) to BunyanDebugStream. The problem here is that we're setting a global variable in colors to do this, so if you create two BunyanDebugStreams, one with forceColor and one without, they'd both show colors (although I suppose you'd probably never do this...)

jwalton commented 9 years ago

Fixed in v1.0.7 with forceColor option.

kingcody commented 9 years ago

@jwalton thanks! Sorry for the shortsightedness with the option being globally persistent.

jwalton commented 9 years ago

No worries. Thanks for figuring this out. :)