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`));
  • 相关阅读:
    RAID-磁盘阵列
    Redis-Cluster 5.0.4 集群部署
    linux系统磁盘缩容
    MongoDB Replica Set 集群
    CentOS7 GlusterFS文件系统部署
    CentOS7 firewalld防火墙规则
    centos7 升级openssh到openssh-8.0p1版本
    MySQL 中操作excel表格总结
    超哥带你学GIT
    学习是主动吃苦
  • 原文地址:https://www.cnblogs.com/Answer1215/p/9290890.html
Copyright © 2011-2022 走看看