The global console object contains functions for printing text to the
screen, which can be useful for text-based applications, and is also
useful for debugging.
NOTE: Invoking any method on the console object switches the
application to text rendering mode, clearing any pixels previously
drawn on the screen using the Canvas API.
Type declaration
debug:function
debug(...input): void
Writes the formatted input to the debug log file.
Parameters
Rest...input: unknown[]
Returns void
Note
This function does not invoke text rendering mode, so it can safely be used when rendering with the Canvas API.
error:function
error(...input): void
Logs the formatted input to the screen as red text.
Parameters
Rest...input: unknown[]
Returns void
log:function
log(...input): void
Logs the formatted input to the screen as white text.
Parameters
Rest...input: unknown[]
Returns void
print:function
print(s): void
Prints string s to the console on the screen, without any formatting applied.
Newline is not appending to the end of the string.
Parameters
s: string
The text to print to the console.
Returns void
printErr:function
printErr(s): void
Prints string s to the debug log file, without any formatting applied.
Newline is not appending to the end of the string.
Parameters
s: string
The text to print to the log file.
Returns void
Note
This function does not invoke text rendering mode, so it can safely be used when rendering with the Canvas API.
trace:function
trace(...input): void
Logs the formatted input to the screen as white text,
including a stack trace of where the function was invoked.
Parameters
Rest...input: unknown[]
Returns void
warn:function
warn(...input): void
Logs the formatted input to the screen as yellow text.
The global
console
object contains functions for printing text to the screen, which can be useful for text-based applications, and is also useful for debugging.Most methods use the
Switch.inspect()
method for formatting, and theconsole.print()
method to output to the screen.