Unitech / pm2

Node.js Production Process Manager with a built-in Load Balancer.
https://pm2.keymetrics.io/docs/usage/quick-start/
Other
41.41k stars 2.61k forks source link

No log colors when using winston #1603

Open xiulunlin opened 9 years ago

xiulunlin commented 9 years ago

Without pm2

screen shot 2015-09-10 at 6 52 14 pm

pm2 logs --raw

screen shot 2015-09-10 at 6 52 26 pm
soyuka commented 9 years ago

Same without the --raw option?

xiulunlin commented 9 years ago

@soyuka Yes. The app name is colored but raw data not.

screen shot 2015-09-11 at 5 47 25 pm
soyuka commented 9 years ago

@Tjatse thoughts on this? I try to find from where this issue could come, but we're directly streaming stdout output to the file.

Test case

chaudhryjunaid commented 8 years ago

Yes, this issue exists even when using the --raw option. Strings in pretty printed objects are green, otherwise everything else including log level (info, warn, error) or custom colors using chalk.green, chalk.blue etc are not displayed.

Tjatse commented 8 years ago

So, you wanna enable colors? Just try to use the following declaration / cmd to (re)start your PM2 script:

{
  "apps": [
    {
      "[SOME]":"[CONFIGS]",
      "args": [
        "--color"
      ]
    }
  ]
}

or

$ pm2 start myapp.js -- --color
chaudhryjunaid commented 8 years ago

works like a charm! thanks! :+1:

damianobarbati commented 6 years ago

Is this still valid @chaudhryjunaid ? Because I can see colors at all, no matter the --raw or --color combo (using config.js file).

chaudhryjunaid commented 6 years ago

@damianobarbati I have not used winston with pm2 in a long time now...