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 useColors
boolean 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. type
string <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 black
string red
string green
string blue
string magenta
string cyan
string gray
string grey
string lightgray
string lightgrey
string lightred
string lightgreen
string lightyellow
string lightblue
string lightmagenta
string lightcyan
string white
string #008000
string green 255,0,0
Array <optional>
red 229,50%,50%
Array <optional>
blue -
ColorObjects
-
Properties:
Name Type Description message
MessageObject A message object containing colors and styles. time
TimeObject 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 debug
ColorObjects An object containing a message and time color object. error
ColorObjects An object containing a message and time color object. log
ColorObjects An object containing a message and time color object. verbose
ColorObjects An object containing a message and time color object. warn
ColorObjects An object containing a message and time color object. wtf
ColorObjects An object containing a message and time Color Object. -
MessageObject
-
Properties:
Name Type Description background
BackgroundColorTypes The background color. Can be a basic string like "red", a hex string, or a RGB array. text
TextColorTypes The text color. Can be a basic string like "red", a hex string, or a RGB array. style
StyleTypes A style string from StyleTypes. -
StyleTypes
-
Properties:
Name Type Description normal
string bold
string dim
string italic
string underline
string inverse
string hidden
string strikethrough
string -
TextColorTypes
-
All the valid color types.
Properties:
Name Type Attributes Description black
string red
string green
string yellow
string blue
string magenta
string cyan
string gray
string grey
string lightgray
string lightgrey
string lightred
string lightgreen
string lightyellow
string lightblue
string lightmagenta
string lightcyan
string white
string #008000
string green 255,0,0
Array <optional>
red 229,50%,50%
Array <optional>
blue -
TimeObject
-
Properties:
Name Type Description background
BackgroundColorTypes The background color. Can be a basic string like "red", a hex string, or a RGB array. text
TextColorTypes The text color. Can be a basic string like "red", a hex string, a RGB array, or HSL array. style
StyleTypes A style string from StyleTypes.