[Tools] Using colours in a NodeJS terminal - make your output pop

Posted Answer1215

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[Tools] Using colours in a NodeJS terminal - make your output pop相关的知识,希望对你有一定的参考价值。

Use can use colour and styles to make it easy to spot errors and group common functionality into blocks when viewing a NodeJS console.

This lesson will show how to enhance an Express application to highlight errors, display setup issues to developers and group together output using the color npm package, both in the console and Papertrail which is a hosted logging service.

We use the Colors package in this lesson.

 

 

It is quite useful, make debugging a little bit easier,

console.log(colors.white.bold.bgBlue(" ------Console JOB ---------"))

logger.info(colors.white.bgBlue(" ------BEGIN JOB ---------"));
logger.info(colors.white.bgBlue("Running Job XYZ"));
logger.info(colors.white.bgBlue(" ------END JOB ---------"));
logger.info(colors.white.bgMagenta(" ------BEGIN PAY ---------"));
logger.info(colors.white.bgMagenta("Running Job XYZ"));
logger.info(colors.white.bgMagenta(" ------END PAY ---------"));
logger.error(colors.white.bgMagenta(" ------END PAY ---------"));
logger.info(
  colors.yellow.inverse(
    " **** CAUTION Running in Test Mode - Check variables file ****"
  )
);
logger.info(colors.rainbow(` running → http://localhost:3000`));

 

以上是关于[Tools] Using colours in a NodeJS terminal - make your output pop的主要内容,如果未能解决你的问题,请参考以下文章

change grayscale to pseudo colouring using colormap in Matlab

Using The Chrome Developer Tools

Using geometry objects with geoprocessing tools

[Debug] Diagnose a Slow Page Using Developer Tools

You can find the timer(s) that are using too much CPU time using the Developer Tools timeline

[Tools] Using mobile device for debugging your mobile web site