zoukankan      html  css  js  c++  java
  • [Tools] Using colours in a NodeJS terminal

    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`));
  • 相关阅读:
    DOM基础(二)
    DOM基础(一)
    JS入门(五)
    linux的用法
    一道关于运行顺序题
    vue框架
    HTML的知识点
    从队友那偷来的主席树模板(静态区间第k小)
    网络流基础模型——任务分配模型(HDU 3572)
    HDU 5521 Meeting(建图思维)
  • 原文地址:https://www.cnblogs.com/Answer1215/p/9290890.html
Copyright © 2011-2022 走看看