Marak / colors.js

get colors in your node.js console
https://github.com/Marak/colors.js
Other
5.17k stars 446 forks source link

Official way to combine colors with bunyan #125

Closed ORESoftware closed 6 years ago

ORESoftware commented 9 years ago

Is there an official way to use NPM colors with NPM Bunyan?

https://www.npmjs.com/package/bunyan

felipap commented 9 years ago

+1 I'd like this.

felipap commented 9 years ago

Piping colors.js output through bunyan causes the

if (process.stdout && !process.stdout.isTTY) {
  return false;
}

condition in supports-color.js to return false, making colors.supportsColor and colors.enabled both false.

One ugly fix is to monkey-patch colors as soon as it's required.

var colors = require("colors")
colors.enabled = true

Another one is to pass --color or --color=true or --color=always (a little flamboyant, lol), as argv.

Hope it helps.

DABH commented 6 years ago

Does colors.enabled work better with bunyan using colors@next? Feel free to open a PR if you have any specific changes that would improve integration here.

DABH commented 6 years ago

Closing this for now due to lack of activity. Thanks!