Every process has thre

Discuss my database trends and their role in business.
Post Reply
poxoja9630
Posts: 9
Joined: Sun Dec 22, 2024 5:32 am

Every process has thre

Post by poxoja9630 »

Sending WhatsApp Messages with Python
Sending WhatsApp Multimedia Messages with C#
Sending WhatsApp Messages with Java
Sending WhatsApp Messages with PHP
I look forward to seeing what you build. Feel free to contact me and share your experiences or ask me questions.

Email address:
Twitter:
GitHub: SagNew
Twitch (live code streaming): SagnewshrougesWhen you philippines mobile number example start developing in JavaScript, one of the first things you probably learn is how to log things to the console using console.log. If you do any research on how to debug JavaScript, you'll find hundreds of blog posts and StackOverflow articles telling you to "just" use console.log. And since it's common practice, we've even started using linter rules like no-consoleto make sure we don't accidentally leave log entries in our production code. But what if we really want to log something intentionally to provide more information?

In this blog, we'll look at different situations where you might want to log information, discuss the difference between console.log and console.error in Node.js, and see how to ship log entries to your libraries without cluttering the user console.

JavaScript

Image

Copy the code
console.log(`Let's go!`);
Theory First: Important Details About Node.js
Although you can use either console.log or console.error in the browser as well as Node.js, there is one important thing you need to keep in mind when using Node.js. When you write the following code in Node.js in a file called index.js :

JavaScript

Copy the code
console.log('Hello there');
console.error('Bye bye');
And you run it in the terminal using node index.js, you see the output of both directly after each other:

Terminal screenshot running “node index.js”
However, while these two codes may seem identical, they are actually treated differently by the system. If you look at the console section of the Node.js documentation you will see that prints to while uses .console.logstdoutconsole.errorstderr

Every process has three streams default streams to work with, namely stdin, , stdout and stderr. The stream stdin handles the input that comes into your process. For example, when buttons are pressed or output is redirected (we'll get to that in a moment). The flow stdout is for output from your application. Finally, stderr is for error messages. If you want to understand why stderr exists and when to use it, check out this article .

In short, this allows us to use the redirection ( >) and pipe (|) operators to work on error and diagnostic information separately from the actual output of an application. While > allows us to redirect the output of a command to a file, 2> allows us to redirect the output of stderr to a file. For example, this command would pass "Hello there" to a file named hello.log and "Bye bye" to a file named error.log.
Post Reply