graceful-console
Synopsis
Decorator console module that adds color, formatting, sorting, etc.. to the node console.
Code Example
The new console gives you more control. More colors. Line Numbers. Sorting. Etc... Contribute!
// Set a global variable called scribeglobalscribe = ; // Use the global instance to logscribe;scribe;scribe;scribe;
Drum role please...
Get Started
Use NPM to install npm install graceful-console --save
Last step:
globalscribe = ;
API Reference
scribe.settings(obj), scribe.options(obj)
Settings sets these options till they are unset. Options sets these options for the immediate next log, info, warn, error, critical, etc.
opts
Choose the scribe options: write path, stack, time, and/or lvl.
write
: path dictates where scribe should output a scribe log file too.isStack
: dictates weather or not to show line numbers and file names. This is resource intensive. Dont enable in production.isTime
: dictates weather or not to show a time stamp.maxLvl
: dictates how much information you want scribe to print: do you want to print all scribe messages or just errors? (scribe.ERROR || scribe.CRITICAL << scribe.WARN << scribe.ALL || scribe.INFO
)label
: For advanced users! Instead use the alias scribe#warn, scribe#error, scribe#info, and scribe#critical.lvl
: For advanced users! Instead use the alias scribe#warn, scribe#error, scribe#info, and scribe#critical.sort
: Do not use! Instead use the alias scribe#sort.tag
: Do not use! Instead use the alias scribe#tag.
scribe.log(str), scribe.error(str), scribe.info(str), scribe.warn(str), scribe.critical(str)
Takes a string str
as the output tag. Prints str
to stdout with newline. Eats the current options such as tag and sort.
scribe;scribe;scribe;scribe;scribe;
scribe.tag(str)
Takes a string str
as the output tag. The next log, error, warn, info will be tagged with the str
.
scribe;
scribe.sort(arg)
Takes a function or a boolean arg
. The next log, error, warn, info will be sorted.
scribe;scribe;scribe;
scribe.break(str)
Prints a new line.
scribe;
scribe.chunk(func)
Takes a function func
where every call to scribe chunks text using spacing and pretty formatting.
scribe;
scribe.dir, scribe.assert, scribe.time, scribe.timeEnd
Alias to the console equivalent (i.e. console.dir, console.assert, etc). Refer to Node documentation for behavior https://nodejs.org/api/scribe.html#scribe_scribe_log_data
TODO
- Update scribe to take into account toString when printing javascript objects
- Add changelog to readme
License
MIT