NodeJS Logging using Bunyan Package

In order to log your errors in NodeJS, you need NPM Package called Bunyan. 
 
Type the following command in terminal.  
  1. npm install bunyan   
Once you install bunyan, you can use it to log the errors.

Create one .js file with the name - "example.js".  
 
Type the following code inside.   
  1. var banyan = require('banyan')  
  2. var log = bunyan.createLogger({name:'myTest'})  
  3. log.info('This is 1st log message')  
  4. log.info('This is 2nd message')  
Now save the file. You can execute the code on command prompt by typing the code. 
  1. node example.js