标签:span bsp nodejs using console output bug 分享 magent
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
标签:span bsp nodejs using console output bug 分享 magent
原文地址:https://www.cnblogs.com/Answer1215/p/9290890.html