colorprint
Print ansi-colored message to stdout/stderr.
Installation
npm install colorprint --save
Usage
"use strict";
const colorpint = require('colorpint')
colorpint.notice('This is NOTICE')
colorpint.info('This is INFO')
colorpint.debug('This is DEBUG')
colorpint.trace('This is TRACE')
colorpint.warn('This is WARN')
colorpint.error('This is ERROR')
colorpint.fatal('This is FATAL')
Using via CIL
Install globally
$ npm install colorprint -g
From Command Line
#!/bin/bash
colorpint notice "This is NOTICE from CLI"
colorpint info "This is INFO from CLI"
colorpint debug "This is DEBUG from CLI"
colorpint trace "This is TRACE from CLI"
colorpint warn "This is WARN from CLI"
colorpint error "This is ERROR from CLI"
colorpint fatal "This is FATAL from CLI"
Customizing
Customize the whole module.
"use strict";
const colorprint = require('colorprint');
colorprint.PREFIX='Yeah!';
colorprint.INFO_COLOR='blue';
colorprint.info('This will be blue with prefix.');
Create new context to customize.
"use strict";
const Colorprint = require('colorprint/lib/colorprint');
let colorprint = new Colorprint({
PREFIX: '[Foo]',
INFO_COLOR: 'blue'
});
colorprint.info('This will be blue with prefix.');
colorprint is using cli-color for coloring and you can see available colors here.
License
This software is released under the MIT License.