cout
A basic JavaScript console utility with sprintf and colors support.
##Install
sudo npm install --save cout
##Usage
var cout = require('cout'),
sprintf = cout.kawari;
cout.config({
cout: ['warn', 'error']
});
cout("Hello", "World", {hello: "world"}, ['hello', 'world'], 1,2,3).end();
cout("Hello", "World", {hello: "world"}, ['hello', 'world'], 1,2,3).endl();
cout("Hello", "World", {hello: "world"}, ['hello', 'world'], 1,2,3).warn();
cout("Hello", "World", {hello: "world"}, ['hello', 'world'], 1,2,3).warn({bg: 'green', style: 'bold'});
cout(sprintf('...', '...')).warn();
##Methods
end()
endl()
warn()
data()
debug()
error()
help()
info()
input()
prompt()
silly()
verbose()
##Config
The following are the default values but can be changed
cout.config({
....options....
});
{
cout: ['*'],
theme: {
data: 'grey',
debug: 'blue',
error: 'red',
help: 'cyan',
info: 'green',
input: 'grey',
prompt: 'grey',
silly: 'rainbow',
verbose: 'cyan',
warn: 'yellow',
},
json:{
space: 2
},
newline: '\n'
}
##Styles
####Usage
{style: ...}
- reset
- bold
- dim
- italic
- underline
- inverse
- hidden
- strikethrough
##Background color
####Usage
{bg: ...}
- black
- red
- green
- yellow
- blue
- magenta
- cyan
- white
##Time stamp
cout uses Moment.js for time stamps. See Moment.js' docs for formatting and locales.
###Usage
Default: false
Acceptable types: Boolean, Plain Object
true or false
timestamp:{
format:'dddd',
locale: 'ja',
space: '\n'
}
##Changlog
0.0.1
0.0.2
- Cleaned code and removed confusing debug statement.
- Updated readme
0.0.3
- Updated readme
- Removed unnecessary comments.
0.0.4
- Added node_modules to .gitignore
0.0.5
- Added boolean support. You can now set
{cout:...}
to true
or false
.
0.0.6
- Added time stamp support. You can pass a Boolean or configure the time stamp's locale and format by passing a plain Object.
- Added 'normal' level for end() and endl() when using an array with levels.