console.browser
v10.3.7
Published
Node.js doesn't show colors when it comes to logging/debugging. This package solves this problem and improves actual logging by adding a bunch of the other colors.
Downloads
15
Maintainers
Readme
How to use / import
First of all, install the package by using npm
or yarn
by tapping:
npm install console.browser --save
//or
yarn add console.browser
You only need to import the package by destructuring the module :
const { console } = require("console.browser");
console.nor("Hey");
This will return the console object with more colors
If you want to nest colors you can take/add an other variable in the destructuring:
const { console, colors } = require("console.browser");
console.warn(
"Hey",
colors.inverse("Inverse this!"),
colors.rainbow("I'm a rainbow !!")
);
Members
nor ⇒
Equivalent to console.log but outputs the data in a blue tint to be more visible when logging information
Kind: global variable Returns: Data with a blue tinit
| Param | Type | Description | | ------- | ---------------- | ------------------ | | ...args | any | The data to output |
success ⇒
Outputs a success message to the console
Kind: global variable Returns: Data with green color
| Param | Type | Description | | ------- | ---------------- | ------------------ | | ...args | any | The data to output |
Example
console.success("I just hacked Nasaaaaaaaaaaa !");
error ⇒
When debugging for example in a try{}catch{}
Kind: global variable Returns: Data with red color
| Param | Type | Description | | ------- | ---------------- | ------------------ | | ...args | any | The data to output |
Example
console.error("OMG! I just did a stupid error!");
warn ⇒
Outputs a warning message to the console with a yellow color
Kind: global variable Returns: Data with yellow color
| Param | Type | Description | | ------- | ---------------- | ------------------ | | ...args | any | The data to output |
Example
console.warn("The world will end in one week !");
info ⇒
Outputs an informational message to the console
Kind: global variable Returns: Data with dark blue color
| Param | Type | Description | | ------- | ---------------- | ------------------ | | ...args | any | The data to output |
Example
console.info(
"Did you know that Leonard de Vinci was born in 1452 in Anchiano ?"
);
rainbow ⇒
Outputs the multicolored data
Kind: global variable Returns: Rainbow output
| Param | Type | Description | | ------- | ---------------- | ------------------ | | ...args | any | The data to output |
Example
console.rainbow(
"The way I see it, if you want the rainbow, you gotta put up with the rain."
);
zebra ⇒
Outputs the data in black and white
Kind: global variable Returns: Zebra output
| Param | Type | Description | | ------- | ---------------- | ------------------ | | ...args | any | The data to output |
Example
console.zebra(`Wait am i in savanna ?`);
bold ⇒
Outputs the data in bold
Kind: global variable Returns: Bold output
| Param | Type | Description | | ------- | ---------------- | ------------------ | | ...args | any | The data to output |
Example
console.bold("I'm bold");
dim ⇒
Outputs the data in dim
Kind: global variable Returns: Dim output
| Param | Type | Description | | ------- | ---------------- | ------------------ | | ...args | any | The data to output |
Example
console.dim("I'm a dim output !");
inverse ⇒
Outputs the inverse of the given data
Kind: global variable Returns: Inverse of the data
| Param | Type | Description | | ------- | ---------------- | ------------------ | | ...args | any | The data to output |
Example
console.inverse("I'm a inverse output !");
italic ⇒
Outputs the data in italic
Kind: global variable Returns: Italic output
| Param | Type | Description | | ------- | ---------------- | ------------------ | | ...args | any | The data to output |
Example
console.italic("I'm in italic !");
underline ⇒
Underlines the data
Kind: global variable Returns: Underlined output
| Param | Type | Description | | ------- | ---------------- | ------------------ | | ...args | any | The data to output |
Example
console.underline("I'm underlined !");
allown ⇒
Isolates that given data to be more visible
Kind: global variable Returns: Isolated output
| Param | Type | Description | | ------- | ---------------- | ------------------ | | ...args | any | The data to output |
Example
console.allown("This is isolated from the rest of the console");
newline ⇒
Shows each argument on a new line.
Kind: global variable Returns: Each argument on a new line
| Param | Type | Description | | ------- | ---------------- | ------------------ | | ...args | any | The data to output |
Example
console.newline(
"This is on the first line",
"This is on the second line",
"This is on the third line"
);
json ⇒
Shows each argument on a new line in a json format
Kind: global variable Returns: Each argument on a new line
| Param | Type | Description | | ------- | ---------------- | ------------------ | | ...args | any | The data to output |
Example
console.json(name, surname, username); //equivalent to writing console.log({name}, "\n", {surname}, "\n", {username})