class Console extends Object
The console module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers.
The module exports two specific components:
- A Console class with methods such as console.log(), console.error() and console.warn() that can be used to write to any Node.js stream.
- A global console instance configured to write to stdout and stderr. Because this object is global, it can be used without calling require('console').
- Annotations
- @RawJSType() @native() @JSImport( "console" , "Console" )
- See also
https://nodejs.org/dist/latest-v8.x/docs/api/console.html
- Alphabetic
- By Inheritance
- Console
- Object
- Any
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
assert(value: Any, args: Any*): Unit
A simple assertion test that verifies whether value is truthy.
A simple assertion test that verifies whether value is truthy. If it is not, an AssertionError is thrown. If provided, the error message is formatted using util.format() and used as the error message.
console.assert(value[, message][, ...])
Example: -
def
assert(value: Any, message: String, args: Any*): Unit
A simple assertion test that verifies whether value is truthy.
A simple assertion test that verifies whether value is truthy. If it is not, an AssertionError is thrown. If provided, the error message is formatted using util.format() and used as the error message.
console.assert(value[, message][, ...])
Example: -
def
clear(): Unit
When stdout is a TTY, calling console.clear() will attempt to clear the TTY.
When stdout is a TTY, calling console.clear() will attempt to clear the TTY. When stdout is not a TTY, this method does nothing.
Note: The specific operation of console.clear() can vary across operating systems and terminal types. For most Linux operating systems, console.clear() operates similarly to the clear shell command. On Windows, console.clear() will clear only the output in the current terminal viewport for the Node.js binary.
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
count(label: String = js.native): Unit
Maintains an internal counter specific to label and outputs to stdout the number of times console.count() has been called with the given label.
Maintains an internal counter specific to label and outputs to stdout the number of times console.count() has been called with the given label.
- label
the display label for the counter. Defaults to 'default'.
-
def
countReset(label: String = js.native): Unit
Resets the internal counter specific to label.
Resets the internal counter specific to label.
- label
the display label for the counter. Defaults to 'default'.
-
def
dir(obj: Any): Unit
Uses util.inspect() on obj and prints the resulting string to stdout.
Uses util.inspect() on obj and prints the resulting string to stdout. This function bypasses any custom inspect() function defined on obj
console.dir(obj[, options])
Example: -
def
dir(obj: Any, options: ConsoleDirOptions): Unit
Uses util.inspect() on obj and prints the resulting string to stdout.
Uses util.inspect() on obj and prints the resulting string to stdout. This function bypasses any custom inspect() function defined on obj
console.dir(obj[, options])
Example: -
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
error(data: Any, args: Any*): Unit
Prints to stderr with newline.
Prints to stderr with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf(3) (the arguments are all passed to util.format()).
- data
the given data arguments
console.error([data][, ...])
Example: -
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
group(label: Any*): Unit
Increases indentation of subsequent lines by two spaces.
Increases indentation of subsequent lines by two spaces. If one or more labels are provided, those are printed first without the additional indentation.
- label
the labels
-
def
groupCollapsed(): Unit
An alias for console.group().
-
def
groupEnd(): Unit
Decreases indentation of subsequent lines by two spaces.
-
def
hasOwnProperty(v: String): Boolean
- Definition Classes
- Object
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
def
info(data: Any, args: Any*): Unit
The console.info() function is an alias for console.log().
The console.info() function is an alias for console.log().
console.info([data][, ...])
Example: -
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isPrototypeOf(v: Object): Boolean
- Definition Classes
- Object
-
def
log(data: Any, args: Any*): Unit
Prints to stdout with newline.
Prints to stdout with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf(3) (the arguments are all passed to util.format()).
- data
the given data arguments
console.log([data][, ...])
Example: -
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
propertyIsEnumerable(v: String): Boolean
- Definition Classes
- Object
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
time(label: String): Unit
Starts a timer that can be used to compute the duration of an operation.
Starts a timer that can be used to compute the duration of an operation. Timers are identified by a unique label. Use the same label when you call console.timeEnd() to stop the timer and output the elapsed time in milliseconds to stdout. Timer durations are accurate to the sub-millisecond.
console.time(label)
Example: -
def
timeEnd(label: String): Unit
Stops a timer that was previously started by calling console.time() and prints the result to stdout
Stops a timer that was previously started by calling console.time() and prints the result to stdout
console.timeEnd(label)
Example: -
def
toLocaleString(): String
- Definition Classes
- Object
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
trace(message: String, args: Any*): Unit
Prints to stderr the string 'Trace :', followed by the util.format() formatted message and stack trace to the current position in the code.
Prints to stderr the string 'Trace :', followed by the util.format() formatted message and stack trace to the current position in the code.
console.trace(message[, ...])
Example: -
def
valueOf(): Any
- Definition Classes
- Object
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
warn(data: Any, args: Any*): Unit
Prints to stdout with newline.
Prints to stdout with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf(3) (the arguments are all passed to util.format()).
- data
the given data arguments
console.log([data][, ...])
Example: