Packages

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 process.stdout and process.stderr. The global console can be used without calling require('console').

Warning: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the note on process I/O for more information.

Annotations
@RawJSType() @native() @JSImport("console", "Console")
See also

https://nodejs.org/api/console.html

Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Console
  2. Object
  3. Any
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new Console(options: ConsoleOptions)
  2. new Console(stdout: IWritable, stderr: IWritable = js.native, ignoreErrors: Boolean = true)
  3. new Console()
    Attributes
    protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def assert(value: Any, optionalParams: 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.

    value

    The value tested for being truthy

    optionalParams

    The arguments passed to the error message

  6. def assert(value: Any, message: String, optionalParams: 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.

    value

    The value tested for being truthy

    message

    The error message

    optionalParams

    The arguments passed to message

  7. 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.

    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.

  8. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  9. 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. Default: 'default'.

  10. 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. Default: 'default'.

  11. def debug(message: Any, optionalParams: Any*): Unit

    The console.debug() function is an alias for console.log().

  12. def dir(obj: Any, options: ConsoleDirOptions = js.native): Unit

    Uses io.scalajs.nodejs.util.Util.inspect() on obj and prints the resulting string to stdout.

    Uses io.scalajs.nodejs.util.Util.inspect() on obj and prints the resulting string to stdout. This function bypasses any custom inspect() function defined on obj.

  13. def dirxml(data: Any*): Unit

    This method callslog() passing it the arguments received.

    This method callslog() passing it the arguments received. Please note that this method does not produce any XML formatting

  14. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  15. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  16. def error(message: Any, optionalParams: 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 io.scalajs.nodejs.util.Util.format().

    If formatting elements (e.g. %d) are not found in the first string thenio.scalajs.nodejs.util.Util.inspect() is called on each argument and the resulting string values are concatenated. See io.scalajs.nodejs.util.Util.format() for more information.

  17. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  18. 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.

  19. def groupCollapsed(label: Any*): Unit

    An alias for group()

  20. def groupEnd(): Unit

    Decreases indentation of subsequent lines by two spaces.

  21. def hasOwnProperty(v: String): Boolean
    Definition Classes
    Object
  22. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  23. def info(message: Any, optionalParams: Any*): Unit

    The console.info() function is an alias for log().

  24. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  25. def isPrototypeOf(v: Object): Boolean
    Definition Classes
    Object
  26. def log(message: Any, optionalParams: 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()).

  27. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  28. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  29. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  30. def profile(label: String = js.native): Unit

    This method does not display anything unless used in the inspector.

    This method does not display anything unless used in the inspector. The console.profile() method starts a JavaScript CPU profile with an optional label until profileEnd() is called. The profile is then added to the **Profile** panel of the inspector.

  31. def profileEnd(label: String = js.native): Unit

    This method does not display anything unless used in the inspector.

    This method does not display anything unless used in the inspector. Stops the current JavaScript CPU profiling session if one has been started and prints the report to the **Profiles** panel of the inspector. See profile() for an example.

    If this method is called without a label, the most recently started profile is stopped.

  32. def propertyIsEnumerable(v: String): Boolean
    Definition Classes
    Object
  33. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  34. def time(label: String = js.native): 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 calling timeEnd() to stop the timer and output the elapsed time in milliseconds to stdout. Timer durations are accurate to the sub-millisecond.

  35. def timeEnd(label: String = js.native): Unit

    Stops a timer that was previously started by calling time() and prints the result to stdout.

  36. def timeStamp(label: String = js.native): Unit

    This method does not display anything unless used in the inspector.

    This method does not display anything unless used in the inspector. The console.timeStamp() method adds an event with the label 'label' to the **Timeline** panel of the inspector.

  37. def toLocaleString(): String
    Definition Classes
    Object
  38. def toString(): String
    Definition Classes
    AnyRef → Any
  39. def trace(message: Any, optionalParams: Any*): Unit

    Prints to stderr the string 'Trace: ', followed by the io.scalajs.nodejs.util.Util.format() formatted message and stack trace to the current position in the code.

  40. def valueOf(): Any
    Definition Classes
    Object
  41. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  42. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  43. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  44. def warn(message: Any, optionalParams: Any*): Unit

    The console.warn() function is an alias for

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated @deprecated
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

  2. def markTimeline(label: String = js.native): Unit

    This method does not display anything unless used in the inspector.

    This method does not display anything unless used in the inspector.

    The console.markTimeline() method is the deprecated form of timeStamp().

    Annotations
    @deprecated
    Deprecated

    (Since version NodeJS 8.0.0) Use timeStamp instead

  3. def timeline(label: String = js.native): Unit

    This method does not display anything unless used in the inspector.

    This method does not display anything unless used in the inspector. The console.timeline() method is the deprecated form of time().

    Annotations
    @deprecated
    Deprecated

    (Since version NodeJS 8.0.0) Use time instead

  4. def timelineEnd(label: String = js.native): Unit

    This method does not display anything unless used in the inspector.

    This method does not display anything unless used in the inspector. The console.timelineEnd() method is the deprecated form of timeEnd().

    Annotations
    @deprecated
    Deprecated

    (Since version NodeJS 8.0.0) Use time instead

Inherited from Object

Inherited from Any

Inherited from AnyRef

Inherited from Any

Ungrouped