[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的更多相关文章
- Node.js学习笔记(二) --- CommonJs和Nodejs 中自定义模块
一. 什么是 CommonJs? JavaScript 是一个强大面向对象语言,它有很多快速高效的解释器. 然而, JavaScript标准定义的 API 是为了构建基于浏览器的应用程序.并没有制定一 ...
- Nodejs入门级基础+实战
这篇随笔将会按序记录如下内容: NodeJs 简介 安装 NodeJs HTTP 模块.URL 模块 CommonJs 和 Nodejs 中自定义模块 NodeJs FS 模块 利用 HTTP 模块 ...
- Git 的详细使用
本文翻译自Understanding Git Source Control in Xcode (译者myShire)欢迎您加入我们的翻译小组. 在应用程序开发过程中,很重要的一部分工作就是如何进行 ...
- ReactNative win10初体验
根据RN中文网上的文档搭建环境,有的地方说的不是很清楚,所以小白的我搞了很久,终于搭建成功,这里分享一下 1. java: jdk和jre,我下载的是1.8(因为官方文档上说AndroidStudio ...
- 在Xcode中使用Git进行源码版本控制
http://www.cocoachina.com/ios/20140524/8536.html 资讯 论坛 代码 工具 招聘 CVP 外快 博客new 登录| 注册 iOS开发 Swift Ap ...
- Macaca-iOS入门那些事
Macaca-iOS入门那些事 一. 前言 最近有朋友向我请教iOS自动化测试框架选型,刚好前段时间做讲座时发现了macaca,遂试用.所以,下面的内容会只围绕Macaca的iOS部分. 二. Mac ...
- Windows电脑上安装Appium
Windows机器上,除了JAVA的安装和配置外,安装Appium需要如下设置: 0. 安装SDK后设置环境变量 1)新建JAVA_HOME: SDK安装路径,如D:\Program Files\Ja ...
- 【转】在Xcode中使用Git进行源码版本控制 -- 不错
原文网址:http://www.cocoachina.com/ios/20140524/8536.html 本文翻译自Understanding Git Source Control in Xcode ...
- 在Mac OS上配置Android开发环境
1)安装配置NDK 1.1 下载NDK并解压缩 下载路径 https://developer.android.com/tools/sdk/ndk/index.html 在terminal运行: chm ...
随机推荐
- 写出更好的 JavaScript 条件语句
1. 使用 Array.includes 来处理多重条件 // 条件语句 function test(fruit) { if (fruit == 'apple' || fruit == 'strawb ...
- 解决:xxx is not in the sudoers file.This incident will be reported.的解决方法
Linux中普通用户用sudo执行命令时报”xxx is not in the sudoers file.This incident will be reported”错误,解决方法就是在/etc/s ...
- Js控制样式的诸多方法
function TableCss(options){ //如果没参数,就退出 if(arguments.length < 1 || !document.getElementById(optio ...
- [ SHOI 2012 ] 随机树
\(\\\) \(Description\) 开始有一棵只有一个根节点的树.每次随机选择一个叶子节点,为他添上左右子节点,求: 生成一棵有\(N\)个叶节点的树,所有叶节点平均高度的期望. 生成一棵有 ...
- Python3之Zip
from collections import defaultdict from collections import OrderedDict d = defaultdict(list) d['a'] ...
- Alpha Edition [ Group 1 ]
Deltafish Alpha Edition 一.博客归档(记录人:娄雨禛) 小组会议 DeltaFish 校园物资共享平台 第一次小组会议 DeltaFish 校园物资共享平台 第二次小组会议 D ...
- SQl基本操作——try catch
begin try ... end try begin catch ... end catch
- (转)学习淘淘商城第二十二课(KindEditor富文本编辑器的使用)
http://blog.csdn.net/u012453843/article/details/70184155 上节课我们一起学习了怎样解决KindEditor富文本编辑器上传图片的浏览器兼容性问题 ...
- Windows 8 常见教程
http://www.codeproject.com/Articles/439874/Web-service-on-Windows-Phone http://www.c-sharpcorner.com ...
- CAD计算两曲线间最短路径(com接口)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 3 ...