new KlasaConsole( [options])
Constructs our KlasaConsole instance
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
options |
KlasaConsoleConfig |
<optional> |
The options for the klasa console. |
- Since:
-
- 0.4.0
- Source:
- lib/util/Console.js#L116
Properties
-
colors :boolean|Colors
-
The colors for this console.
Type:
- boolean | Colors
- Since:
-
- 0.4.0
- Source:
- lib/util/Console.js#L149
-
stderr :WritableStream
-
The standard error output stream for this console, defaulted to process.stderr.
Type:
- WritableStream
- Since:
-
- 0.4.0
- Source:
- lib/util/Console.js#L127
-
stdout :WritableStream
-
The standard output stream for this console, defaulted to process.stderr.
Type:
- WritableStream
- Since:
-
- 0.4.0
- Source:
- lib/util/Console.js#L119
-
timestamps :boolean|string
-
Whether or not timestamps should be enabled for this console.
Type:
- boolean | string
- Since:
-
- 0.4.0
- Source:
- lib/util/Console.js#L140
-
useColors :boolean
-
Whether or not this console should use colors.
Type:
- boolean
- Since:
-
- 0.4.0
- Source:
- lib/util/Console.js#L147
Methods
-
<static> flatten(data, useColors)
-
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 - Since:
-
- 0.4.0
- Source:
- lib/util/Console.js#L296
Returns:
- Type
- string
-
debug(data)
-
Calls a debug write with everything to the console/writable stream.
Parameters:
Name Type Argument Description data
* <repeatable>
The data we want to print. - Since:
-
- 0.4.0
- Source:
- lib/util/Console.js#L241
Returns:
- Type
- void
-
error(data)
-
Calls an error write with everything to the console/writable stream.
Parameters:
Name Type Argument Description data
* <repeatable>
The data we want to print. - Since:
-
- 0.4.0
- Source:
- lib/util/Console.js#L231
Returns:
- Type
- void
-
log(data)
-
Calls a log write with everything to the console/writable stream.
Parameters:
Name Type Argument Description data
* <repeatable>
The data we want to print. - Since:
-
- 0.4.0
- Source:
- lib/util/Console.js#L211
Returns:
- Type
- void
-
messages(string, message)
-
Logs everything to the console/writable stream.
Parameters:
Name Type Description string
string The data we want to print. message
string The message format used for coloring - Since:
-
- 0.4.0
- Source:
- lib/util/Console.js#L284
Returns:
- Type
- string
-
timestamp(timestamp, time)
-
Logs everything to the console/writable stream.
Parameters:
Name Type Description timestamp
Date The timestamp to maybe format time
string The time format used for coloring - Since:
-
- 0.4.0
- Source:
- lib/util/Console.js#L272
Returns:
- Type
- string
-
verbose(data)
-
Calls a verbose write with everything to the console/writable stream.
Parameters:
Name Type Argument Description data
* <repeatable>
The data we want to print. - Since:
-
- 0.4.0
- Source:
- lib/util/Console.js#L251
Returns:
- Type
- void
-
warn(data)
-
Calls a warn write with everything to the console/writable stream.
Parameters:
Name Type Argument Description data
* <repeatable>
The data we want to print. - Since:
-
- 0.4.0
- Source:
- lib/util/Console.js#L221
Returns:
- Type
- void
-
write(data [, type])
-
Logs everything to the console/writable stream.
Parameters:
Name Type Argument Default Description data
* The data we want to print. type
string <optional>
"log" The type of log, particularly useful for coloring. - Since:
-
- 0.4.0
- Source:
- lib/util/Console.js#L196
-
wtf(data)
-
Calls a wtf (what a terrible failure) write with everything to the console/writable stream.
Parameters:
Name Type Argument Description data
* <repeatable>
The data we want to print. - Since:
-
- 0.4.0
- Source:
- lib/util/Console.js#L261
Returns:
- Type
- void
Type Definitions
-
BackgroundColorTypes
-
One of these strings, HexStrings, RGB, or HSL are valid types.
Type:
- *
- Source:
- lib/util/Console.js#L73
Properties:
Name Type Argument 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 -
Colors
-
Time is for the timestamp of the log, message is for the actual output.
Type:
- object
- Source:
- lib/util/Console.js#L11
Properties:
Name Type Description debug
KlasaConsoleColorObjects An object containing a message and time color object. error
KlasaConsoleColorObjects An object containing a message and time color object. log
KlasaConsoleColorObjects An object containing a message and time color object. verbose
KlasaConsoleColorObjects An object containing a message and time color object. warn
KlasaConsoleColorObjects An object containing a message and time color object. wtf
KlasaConsoleColorObjects An object containing a message and time Color Object. -
KlasaConsoleColorObjects
-
Type:
- object
- Source:
- lib/util/Console.js#L22
Properties:
Name Type Argument Default Description type
string <optional>
'log' The method from Console this color object should call. message
KlasaConsoleMessageObject A message object containing colors and styles. time
KlasaConsoleTimeObject A time object containing colors and styles. -
KlasaConsoleMessageObject
-
Type:
- object
- Source:
- lib/util/Console.js#L30
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. -
KlasaConsoleTimeObject
-
Type:
- object
- Source:
- lib/util/Console.js#L38
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. -
StyleTypes
-
Type:
- *
- Source:
- lib/util/Console.js#L98
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.
Type:
- *
- Source:
- lib/util/Console.js#L46
Properties:
Name Type Argument 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 #008000
string green 255,0,0
Array <optional>
red 229,50%,50%
Array <optional>
blue