So the console log method is one way to go about logging something to the standard output. In other words creating a script that when it is called by node it displays something in the command line.
So if I create a file called basic.js in a folder that looks like this:
And then go to the folder in which that javaSript file is stored and use node to run it, then the console log method will spit what I am logging with the console log method to the standard output when called.
It is possible to create a custom logger that will log to some other kind of stream such as a file write stream in the file system module, or a tpc connecting using the net module. To do this I just need to call the console constructor of the node console global to create a new logger. When doing so I pass the stream that I want to use for the normal output as the first argument and then another stream that I want to use for the standard error output as the second argument when calling the constructor.