console-extended
The goal is to extend the console
object in Node.js for better readability/usability to logging in terminals.
It adds methods to the console
and uses and works well in combination with the colors
module.
For example:
Usage
Install the module
npm install console-extended
Then require it in your Node.js code:
;
This will extend your console
object with additional methods/properties.
Thus you can start using it:
console;
Methods
console.header(header, log...)
Currently it exports header
method, which styles and pads the first argument as a "header". This is to help you signify from which sub-system a log was made from at a glance. Instead you could use it to log the date and time as well.
console;console;console;console;
The header
takes the first argument, styles it and combines it with the other arguments in a call to console.log
, but if you prefer, you can call the styling function on its' own:
var profilerHeader = consoleext;
This might be useful if you wish to use it for other console.*
methods, such as time/timeEnd:
console;// ...console;
Examples
Here are some real-world examples I took from my localhost master server, as depicted with the example picture above:
console;console;// ...http;https;// ...console;// ...console;// ...console;