new KomadaConsole(stdoutopt, stderropt, colorsopt, timestampsopt)
Constructs our KomadaConsole instance
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
stdout |
boolean |
<optional> |
process.stdout | The location of standard output. Must be a writable stream. |
stderr |
boolean |
<optional> |
process.stderr | The location of standrad error outputt. Must be a writable stream. |
colors |
boolean |
<optional> |
{} | The colors for this console instance. |
timestamps |
boolean |
<optional> |
false | Whether or not Timestamps should be enabled. |
Members
-
colors :boolean|Colors
-
The colors for this console.
-
stderr :WritableStream
-
The standard error output stream for this console, defaulted to process.stderr.
-
stdout :WritableStream
-
The standard output stream for this console, defaulted to process.stderr.
-
timestamps :boolean
-
Whether or not timestamps should be enabled for this console.
-
useColors :boolean
-
Whether or not this console should use colors.
Methods
-
static flatten(data, useColors) → {string}
-
Flattens our data into a readable string.
Parameters:
Name Type Description data* Some data to flatten useColorsboolean Whether or not the inspection should color the output Returns:
string -
_debug(stuff)
-
Print something to console as a debug log.
Parameters:
Name Type Description stuff* The stuff to log -
_error(stuff)
-
Print something to console as an error.
Parameters:
Name Type Description stuff* The stuff to log -
_log(stuff)
-
Print something to console as a simple log.
Parameters:
Name Type Description stuff* The stuff to log -
_verbose(stuff)
-
Print something to console as a verbose log.
Parameters:
Name Type Description stuff* The stuff to log -
_warn(stuff)
-
Print something to console as a warning.
Parameters:
Name Type Description stuff* The stuff to log -
_wtf(stuff)
-
Print something to console as a "WTF" error.
Parameters:
Name Type Description stuff* The stuff to log -
log(stuff, typeopt)
-
Logs everything to the console/writable stream.
Parameters:
Name Type Attributes Default Description stuff* The stuff we want to print. typestring <optional>
"log" The type of log, particularly useful for coloring.
Type Definitions
-
BackgroundColorTypes
-
One of these strings, HexStrings, RGB, or HSL are valid types.
Properties:
Name Type Attributes Description blackstring redstring greenstring bluestring magentastring cyanstring graystring greystring lightgraystring lightgreystring lightredstring lightgreenstring lightyellowstring lightbluestring lightmagentastring lightcyanstring whitestring #008000string green 255,0,0Array <optional>
red 229,50%,50%Array <optional>
blue -
ColorObjects
-
Properties:
Name Type Description messageMessageObject A message object containing colors and styles. timeTimeObject A time object containing colors and styles. -
Colors
-
Time is for the timestamp of the log, message is for the actual output.
Properties:
Name Type Description debugColorObjects An object containing a message and time color object. errorColorObjects An object containing a message and time color object. logColorObjects An object containing a message and time color object. verboseColorObjects An object containing a message and time color object. warnColorObjects An object containing a message and time color object. wtfColorObjects An object containing a message and time Color Object. -
MessageObject
-
Properties:
Name Type Description backgroundBackgroundColorTypes The background color. Can be a basic string like "red", a hex string, or a RGB array. textTextColorTypes The text color. Can be a basic string like "red", a hex string, or a RGB array. styleStyleTypes A style string from StyleTypes. -
StyleTypes
-
Properties:
Name Type Description normalstring boldstring dimstring italicstring underlinestring inversestring hiddenstring strikethroughstring -
TextColorTypes
-
All the valid color types.
Properties:
Name Type Attributes Description blackstring redstring greenstring yellowstring bluestring magentastring cyanstring graystring greystring lightgraystring lightgreystring lightredstring lightgreenstring lightyellowstring lightbluestring lightmagentastring lightcyanstring whitestring #008000string green 255,0,0Array <optional>
red 229,50%,50%Array <optional>
blue -
TimeObject
-
Properties:
Name Type Description backgroundBackgroundColorTypes The background color. Can be a basic string like "red", a hex string, or a RGB array. textTextColorTypes The text color. Can be a basic string like "red", a hex string, a RGB array, or HSL array. styleStyleTypes A style string from StyleTypes.