Marak / colors.js

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

Recommended method to view logs #276

Closed Slurpgoose closed 3 years ago

Slurpgoose commented 3 years ago

Hi, thank you for creating and maintaining this awesome library.

is there a recommended method to view logs that use colors?

I am using pm2 to generate logs and the output of less errors.log

2020-11-08T22:21:05: ESC[31mmissing ticker for OMG-BTC, will resubscribeESC[39m

The best solution I came up was removing color codes using sed and creating a new file to read using less cat errors.log | sed -r "s/[[:cntrl:]]\[[0-9]{1,3}m//g" | tee errors-copy.log | less errors-copy.log

My preferred solution would be to parse the color codes instead of removing them.

thanks.

Gerrit0 commented 3 years ago

less -R will process color escapes