0.1.6 • Published 4 years ago
console-super v0.1.6
console-super
Add time stamp, color and replace previous line. It all using only console! Make console great again!
Install
npm i console-super
Usage
require('console-super');
console.timeTag("OMG ITS A TIME STAMP");
console.showMs(true);
console.timeTag("AND WITH MS!");
console.timeTag("I CAN EVEN OVERWRITE THIS (IN 4 SECS)");
setTimeout(function(){
console.inlineTimeTag("NO WAY! ITS AWESOME!");
console.timeTag("AND ITS CYAN NOW", 'cyan');
console.timeTag("BRIGHTER", 'cyan', 'bright');
console.timeTag("CHANGE BACKGROUND", 'yellow', 'bright', 'bgGreen');
}, 4000)
Parameters
- data: Data to be shown (
string
,array
,object
,number
) - base (default is 10): If
data
is anumber
type, thenbase
defines in witch base the number must be show, e.g. binary (2), decimal (10), hexdecimal (16), etc. - ...args You can modify the terminal characteristics, like color, its background color and brightness! See at the end all the possibilities.
- {mod1: 'red', mod2: 'bright', mod3: 'bgWhite'}: Same as above just for backward compatibility.
Methods
- console.timeTag(data,base,{mod1, mod2, mod3}):
- console.inlineTimeTag(data,base,{mod1, mod2, mod3}): Overwrites the previous line
- console.showMs(msOnOff):
- Pass
true
orfalse
to toggle the milliseconds to be shown or not console.showMs(true);
- Pass
Modifiers
//Modifiers
'reset' //Reset to default
'bright' //Brighter
'dim' //Dim
'underscore' //Put a underscore beneath everything
'reverse' //Reverses the fore and background colors
//Font colors
'black'
'red'
'green'
'yellow'
'blue'
'magenta'
'cyan'
'white'
//Background colos
'bgBlack'
'bgRed'
'bgGreen'
'bgYellow'
'bgBlue'
'bgMagenta'
'bgCyan'
'bgWhite'
You can integrate with socket
console.setSocket(socket);
console.timeTag("This message is going be shown here and also fires a socket.emit('console', this.message)");