- Node.js Tutorial
- Node.js - Home
- Node.js - Introduction
- Node.js - Environment Setup
- Node.js - First Application
- Node.js - REPL Terminal
- Node.js - Command Line Options
- Node.js - Package Manager (NPM)
- Node.js - Callbacks Concept
- Node.js - Upload Files
- Node.js - Send an Email
- Node.js - Events
- Node.js - Event Loop
- Node.js - Event Emitter
- Node.js - Debugger
- Node.js - Global Objects
- Node.js - Console
- Node.js - Process
- Node.js - Scaling Application
- Node.js - Packaging
- Node.js - Express Framework
- Node.js - RESTFul API
- Node.js - Buffers
- Node.js - Streams
- Node.js - File System
- Node.js MySQL
- Node.js - MySQL Get Started
- Node.js - MySQL Create Database
- Node.js - MySQL Create Table
- Node.js - MySQL Insert Into
- Node.js - MySQL Select From
- Node.js - MySQL Where
- Node.js - MySQL Order By
- Node.js - MySQL Delete
- Node.js - MySQL Update
- Node.js - MySQL Join
- Node.js MongoDB
- Node.js - MongoDB Get Started
- Node.js - MongoDB Create Database
- Node.js - MongoDB Create Collection
- Node.js - MongoDB Insert
- Node.js - MongoDB Find
- Node.js - MongoDB Query
- Node.js - MongoDB Sort
- Node.js - MongoDB Delete
- Node.js - MongoDB Update
- Node.js - MongoDB Limit
- Node.js - MongoDB Join
- Node.js Modules
- Node.js - Modules
- Node.js - Built-in Modules
- Node.js - Utility Modules
- Node.js - Web Module
- Node.js Useful Resources
- Node.js - Quick Guide
- Node.js - Useful Resources
- Node.js - Dicussion
Node.js - Console Module
NodeJS Console is a global object that enables a convenient debugging console to display different message levels. This debugging console is identical to JavaScript console mechanism provided by web-browsers. The console module has two specific components, which are described as below −
Console class − Methods like console.log(), console.warn(), and console.error are present in the console class. Any Node.js stream can be written using these methods.
Global console − The global console instance is configured to write process.stdout and process.stderr(this property returns a stream connected to stdout). It is possible to operate without using the require("node:console") function.
List of Methods
Following are the list of methods available in the console class −
Sr.No | Module & Description |
---|---|
1 |
Used to verify the invariants. |
2 |
Used to clear the stdout (standard output). |
3 |
Used to get the count of the number of times the function has been called with a specific input value. |
4 |
Used to reset the count for the specific input value which is passed as a label. |
5 |
Used to print information to stdout in a new line |
6 |
Used to get the properties of a particular object. |
7 |
Used to call the console.log() method at the time of execution by passing the arguments received. |
8 |
Used to display the error messages on the console. |
9 |
Used to get the passed information in the method as a grouped format. |
10 |
Used to collapse the previously created group by console.group(). |
11 |
Used to end the group; which was created with console.group() and console.groupCollapsed() methods. |
12 |
Used to print information to stdout in a new line. |
13 |
Used to print information to stdout in a new line. |
14 |
Used to create a table in the console. |
15 |
Used to start a timer that we can use to track the time taken by an operation or any function. |
16 |
Used to stop the timer which was previously started by console.time() method. |
17 |
Used to print the elapsed time for a timer that was previously started by calling console.time(). |
18 |
Used to print the stack 'Trace' to the current position of the code followed by the message and substitution values on stderr in a new line. |
19 |
Used to print the warning messages to the console. |
20 |
creates a new Console with one or two instances of writable streams, namely stdout and stderr. |
Inspector only methods
The following methods doesn't display anything unless used in the browser inspector.
Sr.No | Module & Description |
---|---|
1 |
Used to start a JavaScript CPU profile. |
2 |
Used to stop the JavaScript CPU profiling session of the profile, which has been called previously. |
3 |
Used to add an event with or without the label to the timeline panel of the inspector tab. |